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
//package Mura;
/*BY MURAD*/
import com.sun.javafx.collections.MappingChange;
import com.sun.org.apache.xerces.internal.util.SymbolHash;
import javafx.util.Pair;
import java.io.*;
import java.math.BigInteger;
import java.security.PublicKey;
import java.util.*;
import java.io.File;
import java.io.PrintStream;
import static java.lang.Integer.min;
import static java.lang.Integer.parseInt;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.BitSet;
public class Code {
    public static int alic[]=new int[200005];
    public static int bob[]=new int[200005];
   static class Graph {
       private int v;
       private ArrayList<Integer> adj[];
       Graph(int vv) {
           v = vv;
           adj = new ArrayList[v];
           for (int i = 0; i < v; ++i)
               adj[i] = new ArrayList<>();
       }
           void addEdge(int v, int w) {
               adj[v].add(w);
               adj[w].add(v);
           }
           void dfs(int s,int flag,int parent)
           {
               for(int v:adj[s])
               {
                   if(v!=parent)
                   {
                       if(flag==0)
                       {
                           alic[v]=alic[s]+1;
                       }
                       else
                       {
                           bob[v]=bob[s]+1;
                       }
                       dfs(v,flag,s);
                   }
               }
           }
       }
    public static void main(String[] args)throws IOException {
        //Solution ob=new Solution();
        Scanner inp = new Scanner(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n=Integer.parseInt(st.nextToken()),pos=Integer.parseInt(st.nextToken());
        Graph g=new Graph(200005);
        for(int i=0;i<n-1;i++) {
            st = new StringTokenizer(br.readLine());
            int a = Integer.parseInt(st.nextToken()), b = Integer.parseInt(st.nextToken());
            g.addEdge(a, b);
        }
        g.dfs(1,0,-1);
        g.dfs(pos,1,-1);
        int ans=0;
        for(int i=0;i<alic.length;i++)
        {
            if(alic[i]>bob[i])
            {
                ans=Math.max(ans,2*alic[i]);
            }
        }
        System.out.println(ans);
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
    static class Friend implements Comparable<Friend>{
        int m;
        int f;
        public Friend(int m, int f){
            this.m = m;
            this.f = f;
        }
        @Override
        public int compareTo(Friend f) {
            return this.m - f.m;
        }
    }
    public static int[] bctsort(int[] array, int bucketCount) {
        if (bucketCount <= 0) throw new IllegalArgumentException("Invalid bucket count");
        if (array.length <= 1) return array;
        int high = array[0];
        int low = array[0];
        for (int i = 1; i < array.length; i++) {
            if (array[i] > high) high = array[i];

            if (array[i] < low) low = array[i];
        }
        double interval = ((double)(high - low + 1))/bucketCount;
        ArrayList<Integer> buckets[] = new ArrayList[bucketCount];
        for (int i = 0; i < bucketCount; i++) {

            buckets[i] = new ArrayList();

        }
        for (int i = 0; i < array.length; i++) {

            buckets[(int)((array[i] - low)/interval)].add(array[i]);
        }
        int pointer = 0;

        for (int i = 0; i < buckets.length; i++) {

            Collections.sort(buckets[i]);

            for (int j = 0; j < buckets[i].size(); j++) {

                array[pointer] = buckets[i].get(j);

                pointer++;

            }
        }
        return array;
    }
    /*
      int maxValueInMap=(Collections.max(mp.values()));  // This will return max value in the Hashmap
        for (Map.Entry<String, Integer> entry : mp.entrySet()) {  // Itrate through hashmap
            if (entry.getValue()==maxValueInMap) {
                System.out.println(entry.getKey());
                break;
            }
        }
        //vector of vector
        ArrayList <Integer> al [] = (ArrayList <Integer> []) new ArrayList[100001];
    */
}