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.*;
import java.util.*;


/*
 * kishan Thesiya
 * daiict
 * kishanthesiya25@gmail.com
 * 
 * 
 */


public class Main {
	FastScanner in;
	PrintWriter out;

	static ArrayList[] adj;
	static int n;
	static int x;
	static int visited[];
	static int Ad[];
	static int Bd[];
	
	class Item implements Comparable<Item> {
		int num;
		int val;
		
		public Item(int num, int val) {
			super();
			this.num = num;
			this.val = val;
		}

		@Override
		public int compareTo(Item arg0) {
			return Integer.compare(val, arg0.val);
		}
	}
	
    void solve() {
    	n = in.nextInt();
		x = in.nextInt();

		
		adj = new ArrayList[n];
		
		Ad = new int[n];
		Bd = new int[n];
		
		for(int i = 0;i<n;i++){
			adj[i] = new ArrayList();
		}
		
		visited = new int[n];
		
		for(int i = 0;i<n-1;i++){
			int a = in.nextInt()-1;
			int b = in.nextInt()-1;
			
			adj[a].add(b);
			adj[b].add(a);
		}

		
		Ad[0] = 0;
		Bd[--x] = 0;
		
		dfsA(0,0);
		visited = new int[n];
		dfs(x,0);
		int max = 0;
		for(int i = 0;i<n;i++){
			if(Ad[i] > Bd[i]){
				max = Math.max(max, Ad[i]);
			}
			
			//pw.println(Ad[i] + " " + Bd[i]);
		}
		
		out.println(2*max);
    }
    public static void dfsA(int i,int c){
		if(visited[i] == 1){
			return;
		}
		
		Ad[i] = c;
		
		visited[i] = 1;
		
		for(int j = 0;j<adj[i].size();j++){
			dfsA((int)adj[i].get(j),Ad[i]+1);
		}
	}
	
	public static void dfs(int i,int c){

		if(visited[i] == 1){
			return;
		}
		
		Bd[i] = c;
		
		visited[i] = 1;
		
		for(int j = 0;j<adj[i].size();j++){
			dfs((int)adj[i].get(j),Bd[i]+1);
		}
		
	
	}
	
	
	public static long gcd(long x, long y) {
		if (x == 0)
			return y;
		else
			return gcd( y % x,x);
	}
	public static long pow(long n,long p,long m){
        long  result = 1;
         if(p==0)
           return 1;
       if (p==1)
           return n;
       while(p!=0)
       {
           if(p%2==1)
               result *= n;
           if(result>=m)
           result%=m;
           p >>=1;
           n*=n;
           if(n>=m)
           n%=m;
       }
       return result;
       }
	
	
	
	public static boolean isPrime(int n) {
		// Corner cases
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;
 
		// This is checked so that we can skip 
		// middle five numbers in below loop
		if (n % 2 == 0 || n % 3 == 0)
			return false;
 
		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;
 
		return true;
	}
	

	void run() {
		in = new FastScanner();
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(in.br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}
	
	class Tri{
		
		Tri[] arr;
		
		public Tri(){
			arr = new Tri[27];
		}
		
	}

	public static void main(String[] args) {
		new Main().run();
	}
}