Alice got tired of playing the tag game by the usual rules so she offered Bob a little modification to it. Now the game should be played on an undirected rooted tree of n vertices. Vertex 1 is the root of the tree.

Alice starts at vertex 1 and Bob starts at vertex x (x ≠ 1). The moves are made in turns, Bob goes first. In one move one can either stay at the current vertex or travel to the neighbouring one.

The game ends when Alice goes to the same vertex where Bob is standing. Alice wants to minimize the total number of moves and Bob wants to maximize it.

You should write a program which will determine how many moves will the game last.

Input

The first line contains two integer numbers n and x (2 ≤ n ≤ 2·105, 2 ≤ x ≤ n).

Each of the next n - 1 lines contains two integer numbers a and b (1 ≤ a, b ≤ n) — edges of the tree. It is guaranteed that the edges form a valid tree.

Output

Print the total number of moves Alice and Bob will make.

Examples

Input

4 3
1 2
2 3
2 4


Output

4


Input

5 2
1 2
2 3
3 4
2 5


Output

6

Note

In the first example the tree looks like this:

<image>

The red vertex is Alice's starting position, the blue one is Bob's. Bob will make the game run the longest by standing at the vertex 3 during all the game. So here are the moves:

B: stay at vertex 3

A: go to vertex 2

B: stay at vertex 3

A: go to vertex 3

In the second example the tree looks like this:

<image>

The moves in the optimal strategy are:

B: go to vertex 3

A: go to vertex 2

B: go to vertex 4

A: go to vertex 3

B: stay at vertex 4

A: go to vertex 4
    import java.util.*;
    import java.io.*;
    //import java.lang.*;

    public class ranjan{

        //public static Read cin;
        public static InputReader cin;
        public static PrintWriter cout;
        public static int[] prime,alice,bob;
        public static int x;
        public static boolean[] visited;
        public static final long bil = (long)1e9+7;
        public static int fileread = 0; 
        
        public static void main(String ...arg) throws IOException
        {
            /*console writer*/
            cout = new PrintWriter(new BufferedOutputStream(System.out));
            /*Debug Reader*/
            //Scan cin =new Scan();
            if(fileread == 1)
            {
                try
                {
                //cin = new Read(new FileInputStream(new File("in2.txt")));
                cin = new InputReader(new FileInputStream(new File("in1.txt")));
                }
                catch (IOException error){}
            }
            else{
                //cin = new Read(System.in);
                cin = new InputReader(System.in);
            }

            //input
            int n = cin.nextInt();
            x = cin.nextInt();

            alice = new int[n+1];
            bob = new int[n+1];

            //graph
            ArrayList<Integer>[] g = new ArrayList[n+1];
            for(int i=0;i<=n;i++) g[i] = new ArrayList<Integer>();
            for(int i=1;i<n;i++)
            {
                int a = cin.nextInt();
                int b = cin.nextInt();
                g[a].add(b);
                g[b].add(a);
            }
            
            //calculate all the distances
            dfsAlice(g,1,1,0);
            dfsBob(g,x,x,0);

            int ans=0;
            for(int i=1;i<=n;i++) if(alice[i] > bob[i]) ans = Math.max(ans,2*alice[i]);
            cout.print(ans);
            cout.close();
        }

        public static void dfsAlice(ArrayList<Integer>[] g,int node,int parent,int d){
            alice[node] = d;
            for(int child:g[node]) if(child!=parent) dfsAlice(g,child,node,d+1);
        }

        public static void dfsBob(ArrayList<Integer>[] g,int node,int parent,int d){
            bob[node] = d;
            for(int child:g[node]) if(child!=parent) dfsBob(g,child,node,d+1);
        }

    /*
        public static int dfs1(ArrayList<Integer>[] g,int node,int parent){
            if(node == x)
                return 1;
            int ans = 0;
            for(int child:g[node]){
                if(child!=parent)
                    ans += dfs1(g,child,node);
            }
            return ans>0?ans+1:0;
        }

        public static int dfs2(ArrayList<Integer>[] g,int node,int parent){
            int ans = 0;
            boolean leaf = true;
            for(int child:g[node]){
                if(child!=parent && child!=1){
                    ans = Math.max(dfs2(g,child,node),ans);
                    leaf = false;
                }
            }
            if(leaf)
                return 1;
            return ans>0?ans+1:0;
        }
    */

        private static class Pair{
            public int a,b;
            public Pair(int a,int b)
            {
                this.a = a;
                this.b = b;
            }	
        }


        /*public static void seive(int size)
        {
            prime[0] = prime[1] = false;
            int p = 2;
            while(p*p<= size)
            {
                if(prime[p])
                {
                    for(int i=p*p;i<size;i += p)

                        prime[i] = false;
                }
                p++;
            }
        }*/


        public static <K, V> V getOrDefault(HashMap<K,V> map, K key, V defaultValue) {
            return map.containsKey(key) ? map.get(key) : defaultValue;
        }
        
        static void reverseArray(int intArray[], int size) 
        { 
            int i, temp; 
            for (i = 0; i < size / 2; i++) { 
                temp = intArray[i]; 
                intArray[i] = intArray[size - i - 1]; 
                intArray[size - i - 1] = temp; 
            }  
        } 

        public static long mod_pow(long x,long n,long mod) {
            long res=1;
            while(n>0) {
                if((n&1)==1)res=res*x%mod;
                x=x*x%mod;
                n>>=1;
            }
            return res;
        }
        public static int gcd(int n1, int n2) 
        {
            int r;
            while (n2 != 0) 
            {
                r = n1 % n2;
                n1 = n2;
                n2 = r;
            }
            return n1;
        }
    
        /*public static int lcm(int n1, int n2) 
        {
            int answer = (n1 * n2) / (gcd(n1, n2));
            return answer;
        }*/


        static class InputReader {
            final InputStream is;
            final byte[] buf = new byte[1024];
            int pos;
            int size;
    
            public InputReader(InputStream is) {
                this.is = is;
            }
    
            public int nextInt() {
                int c = read();
                while (isWhitespace(c))
                    c = read();
                int sign = 1;
                if (c == '-') {
                    sign = -1;
                    c = read();
                }
                int res = 0;
                do {
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    res = res * 10 + c - '0';
                    c = read();
                } while (!isWhitespace(c));
                return res * sign;
            }
    
            int read() {
                if (size == -1)
                    throw new InputMismatchException();
                if (pos >= size) {
                    pos = 0;
                    try {
                        size = is.read(buf);
                    } catch (IOException e) {
                        throw new InputMismatchException();
                    }
                    if (size <= 0)
                        return -1;
                }
                return buf[pos++] & 255;
            }
    
            static boolean isWhitespace(int c) {
                return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
            }
    
        }

    static class RecursionLimiter {
        public static long maxLevel = 100000L;

        public static void emerge() {
            if (maxLevel == 0)
                return;
            try {
                throw new IllegalStateException("Too deep, emerging");
            } catch (IllegalStateException e) {
                if (e.getStackTrace().length > maxLevel + 1)
                    throw e;
            }
        }
    }


    static class Scan {
            private byte[] buf=new byte[1024];
            private int index;
            private InputStream in;
            private int total;
            public Scan()
            {
                in=System.in;
            }
            public int scan()throws IOException
            {
                if(total<0)
                throw new InputMismatchException();
                if(index>=total)
                {
                    index=0;
                    total=in.read(buf);
                    if(total<=0)
                    return -1;
                }
                return buf[index++];
            }
            public int scanInt()throws IOException
            {
                int integer=0;
                int n=scan();
                while(isWhiteSpace(n))
                n=scan();
                int neg=1;
                if(n=='-')
                {
                    neg=-1;
                    n=scan();
                }
                while(!isWhiteSpace(n))
                {
                    if(n>='0'&&n<='9')
                    {
                        integer*=10;
                        integer+=n-'0';
                        n=scan();
                    }
                    else throw new InputMismatchException();
                }
                return neg*integer;
            }
            public double scanDouble()throws IOException
            {
                double doub=0;
                int n=scan();
                while(isWhiteSpace(n))
                n=scan();
                int neg=1;
                if(n=='-')
                {
                    neg=-1;
                    n=scan();
                }
                while(!isWhiteSpace(n)&&n!='.')
                {
                    if(n>='0'&&n<='9')
                    {
                        doub*=10;
                        doub+=n-'0';
                        n=scan();
                    }
                    else throw new InputMismatchException();
                }
                if(n=='.')
                {
                    n=scan();
                    double temp=1;
                    while(!isWhiteSpace(n))
                    {
                        if(n>='0'&&n<='9')
                        {
                            temp/=10;
                            doub+=(n-'0')*temp;
                            n=scan();
                        }
                        else throw new InputMismatchException();
                    }
                }
                return doub*neg;
            }
            public String scanString()throws IOException
            {
                StringBuilder sb=new StringBuilder();
                int n=scan();
                while(isWhiteSpace(n))
                n=scan();
                while(!isWhiteSpace(n))
                {
                    sb.append((char)n);
                    n=scan();
                }
                return sb.toString();
            }
            private boolean isWhiteSpace(int n)
            {
                if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
                return true;
                return false;
            }
        }

    }

    class Read
    {
        private BufferedReader br;
        private StringTokenizer st;

        public Read(InputStream is)
        { br = new BufferedReader(new InputStreamReader(is)); }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try {st = new StringTokenizer(br.readLine());}
                catch(IOException e)
                    {e.printStackTrace();}
            }
            return st.nextToken();
        }

        int nextInt()
        { return Integer.parseInt(next()); }

        long nextLong()
        { return Long.parseLong(next()); }

        double nextDouble()
        { return Double.parseDouble(next()); }

        String nextLine()
        {
            String str = "";
            try {str = br.readLine();}
            catch(IOException e)
                {e.printStackTrace();}
            return str;
        }
    }

