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.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.Vector;

/*
 * 这个题我们可以记录下每个点到a的距离，以及到b的距离da[],db[]
 * 然后遍历所有点
 * 访问到点p时，如果da<db那么它就有可能是答案，在所有可能的点取出最大值即可
 * 最大值就是2da
 */
public class Main
{
	static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer tok;
	static boolean hasNext()
    {
        while(tok==null||!tok.hasMoreTokens())
        try{
            tok=new StringTokenizer(in.readLine());
        }
        catch(Exception e){
            return false;
        }
        return true;
    }
	static String next()
    {
        hasNext();
        return tok.nextToken();  
    }
	static long nextLong()
    {
        return Long.parseLong(next());
    }
	static int nextInt()
    {
        return Integer.parseInt(next());
    }
	static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
	
	
	static int n;//顶点数
	static int b;//bob的位置
	static int[]da,db;//到a，b的距离	
	static Vector<Integer>[]graph;//树
	//初始化变量
	static void init() {
		n=nextInt();b=nextInt()-1;
		da=new int[n];db=new int[n];
		graph=new Vector[n];
		for(int i=0;i<n;i++)graph[i]=new Vector<Integer>();
	}
	//读入
	static void read() {
		for(int i=0;i<n-1;i++) {
			int a=nextInt()-1,b=nextInt()-1;
			graph[a].add(b);graph[b].add(a);
		}
	}
	//dfs，求距离
	static void dfs(int now,int from,int[]dis) {
		for(int c:graph[now]) {
			if(c!=from) {
				dis[c]=dis[now]+1;
				dfs(c,now,dis);
			}
		}
	}
	//计算最大值
	static int calculate() {
		int ans=0;
		for(int i=0;i<n;i++) {
			if(da[i]>db[i])ans=Math.max(ans,2*da[i]);
		}
		return ans;
	}
	public static void main(String[] args)
	{
		init();
		read();
		dfs(0,0,da);
		dfs(b,b,db);
		out.println(calculate());
		out.flush();
		out.close();
	}
}