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.*;

public class CF813C {
	static class V {
		ArrayList<V> list = new ArrayList<>();
		V p;
		int d, h;
		void dfs(V p, int d) {
			this.p = p; this.d = d;
			for (V v : list)
				if (v != p) {
					v.dfs(this, d + 1);
					h = Math.max(h, v.h + 1);
				}
		}
	}
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int x = Integer.parseInt(st.nextToken()) - 1;
		V[] vv = new V[n];
		for (int i = 0; i < n; i++)
			vv[i] = new V();
		for (int h = 0; h < n - 1; h++) {
			st = new StringTokenizer(br.readLine());
			int a = Integer.parseInt(st.nextToken()) - 1;
			int b = Integer.parseInt(st.nextToken()) - 1;
			vv[a].list.add(vv[b]);
			vv[b].list.add(vv[a]);
		}
		vv[0].dfs(null, 0);
		V v = vv[x];
		int k = (v.d - 1) / 2, max = 0;
		for (int i = 0; i <= k; i++) {
			max = Math.max(max, v.d + v.h);
			v = v.p;
		}
		System.out.println(max * 2);
	}
}
