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 Trees;
import java.util.*;
import java.io.*;
public class TagGame
{
	static ArrayList<Integer> adj[] = new ArrayList[(int) 2e5 + 1];
	static int depth[]=new int[adj.length];
	static int dp[]=new int[adj.length];
	static boolean vis[]=new boolean[adj.length];
	static Stack<Integer> st=new Stack<>();static boolean bool=true;
	static final int mod=(int)1e9+7;static int x;
	static final int inf=(int)1e9;
	static final long INF=(long)1e18;
	public static void main(String[] args) throws IOException
	{
		FastScanner fs=new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
	    int nodes=fs.nextInt();x=fs.nextInt();
	    for(int i=1;i<=nodes;i++)adj[i]=new ArrayList<>();
	    for(int i=1;i<=nodes-1;i++)
	    {
	    	int u=fs.nextInt();int v=fs.nextInt();adj[u].add(v);adj[v].add(u);
	    }
	    dfs(1,0);long ans=0;
	    for(int i:st)
	    {
	    	if(depth[x]-depth[i]<depth[i]-depth[1])
	    	{
	    		long op1=(depth[x]-depth[i])+(dp[i]-(depth[x]-depth[i]));
	    		ans=Math.max(ans,op1*2);
	    	}
	    }
	    out.println(ans);
	    out.close();
	}
	public static int dfs(int node,int dep)
	{
		vis[node]=true;
		depth[node]=dep;
		int max=depth[node];
		if(node==x)
			{bool=false;st.push(node);}
		if(bool)
			st.push(node);
		//System.out.println(st);
		for(int child:adj[node])
		{
			if(!vis[child])
			{
				max=Math.max(max,dfs(child,dep+1));
			}
		}
		if(bool)st.pop();
		dp[node]=max;return max;
	}
	//returns the index of the smallest element in the array that is greater than or equal to
	//the given element.
	public static int lower_bound(int arr[],int key)
	{
		int index=inf,num=0;
		int left=0,right=arr.length-1;
		while(left<=right)
		{
			int mid=left+(right-left)/2;
			if(arr[mid]>=key) {index=mid;num=arr[mid];right=mid-1;}
			else 
				left=mid+1;
		}
		return index==inf ? arr.length:index;
	}
	//returns the index of the smallest element in the array that is less than or equal to
    //the given element.
	public static int upper_bound(int arr[],int key)
	{
		int index=inf,num=0;
		int left=0,right=arr.length-1;
		while(left<=right)
		{
			int mid=left+(right-left)/2;
			if(arr[mid]<=key) {index=mid;num=arr[mid];left=mid+1;}
			else 
				right=mid-1;
		}
		return index==inf ? arr.length:index;
	}
}
class FastScanner 
{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		public String next() 
		{
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
			
		}
		public String nextLine() throws IOException
		{
		    return br.readLine();
		}
		int[] sort(int arr[])
		{
			ArrayList<Integer> list = new ArrayList<Integer>();
			for(int i:arr)list.add(i);
			Collections.sort(list);
			for(int i=0;i<arr.length;i++)
			{
				arr[i]=list.get(i);
			}
			return arr;
		}
		char[] charsort(char arr[])
	        {
	    	ArrayList<Character> list = new ArrayList<>();
	    	for(char c:arr)list.add(c);
	    	Collections.sort(list);
	    	for(int i=0;i<list.size();i++)
	    	{
	    		arr[i]=list.get(i);
	    	}
	    	return arr;
	        }
		long[] longsort(long arr[])
		{
			ArrayList<Long> list = new ArrayList<Long>();
			for(long i:arr)list.add(i);
			Collections.sort(list);
			for(int i=0;i<arr.length;i++)
			{
				arr[i]=list.get(i);
			}
			return arr;
		}
		public int nextInt() 
		{
			return Integer.parseInt(next());
		}
		public int[] readArray(int n)
		{
			int[] arr=new int[n];
			for (int i=0; i<n; i++) arr[i]=nextInt();
			return arr;
		}	
		public long nextLong()
		{
			return Long.parseLong(next());
		}
		public long[] longreadArray(int n) 
		{
			long[] a=new long[n];
			for (int i=0; i<n; i++) a[i]=nextLong();
			return a;
		}
}
