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 ProblemC {

    public static void main(String[] args) throws IOException {
        init();
        new ProblemC().run();
        out.flush();
        out.close();
    }

    static void init() throws IOException {
        in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(new OutputStreamWriter(System.out));
        in.ordinaryChars(0, 65535);
        in.wordChars(0, 65535);
        in.whitespaceChars(' ', ' ');
        in.whitespaceChars('\n', '\n');
        in.whitespaceChars('\r', '\r');
    }

    // класс для пар
    class Pair<L, R> {
        private final L X;
        private final R Y;

        public Pair(L X, R Y) {
            this.X = X;
            this.Y = Y;
        }

        public L getX() {
            return X;
        }

        public R getY() {
            return Y;
        }

        @Override
        public int hashCode() {
            return X.hashCode() ^ Y.hashCode();
        }

        @Override
        public boolean equals(Object o) {
            if (!(o instanceof Pair)) return false;
            Pair pairo = (Pair) o;
            return X.equals(pairo.getX()) && Y.equals(pairo.getY());
        }
    }

    static final long INFL = 200000000000000000L;
    static final int INF = 2000000000;
    static final boolean DEBUG = true;

    static StreamTokenizer in;
    static PrintWriter out;

    static void print(String s) {
        print(s, 0);
    }

    static void print(String s, int debug) {
        if (debug == 0 || DEBUG) {
            out.print(s);
        }
    }

    static void println(String s) {
        println(s, 0);
    }

    static void println(String s, int debug) {
        if (debug == 0 || DEBUG) {
            out.println(s);
        }
    }

    static void printArray(int[] arr) {
        println(Arrays.toString(arr));
    }

    static void printArray(char[] arr) {
        println(Arrays.toString(arr));
    }

    static void printArray(String[] arr) {
        println(Arrays.toString(arr));
    }

    static void sort(int[] a) {
        Random rnd = new Random();
        for (int i = a.length - 1; i > 0; i--) {
            int index = rnd.nextInt(i);
            a[i] ^= a[index];
            a[index] ^= a[i];
            a[i] ^= a[index];
        }
        Arrays.sort(a);
    }

    static char[] inChars;
    static int inCharsInd;

    static String next() throws IOException {
        in.nextToken();
        return in.sval;
    }

    static char nextChar() throws IOException {
        while (inChars == null || inCharsInd >= inChars.length) {
            inChars = next().toCharArray();
            inCharsInd = 0;
        }
        return inChars[inCharsInd++];
    }

    static int nextInt() throws IOException {
        return Integer.valueOf(next());
    }

    static double nextDouble() throws IOException {
        return Double.valueOf(next());
    }

    static long nextLong() throws IOException {
        return Long.valueOf(next());
    }

    private void run() throws IOException {
        solve();
    }

    int K, L, M, N, P;

    class Node {
        List<Node> neigh = new ArrayList<>();
        int visited = 0;
        int maxWayToLeaf = 0;
        Node bestLeaf = this;
        Node parent = null;
        int wayFromRoot = 0;
        int num;
    }

    private void solve() throws IOException {
        N = nextInt();
        int X = nextInt()-1;
        Node[] nodes = new Node[N];

        for (int i = 0; i < N; i++) {
            nodes[i] = new Node();
            nodes[i].num = i;
        }
        for (int i = 0; i < N-1; i++) {
            int a = nextInt()-1, b = nextInt()-1;
            nodes[a].neigh.add(nodes[b]);
            nodes[b].neigh.add(nodes[a]);
        }

        DFS(nodes[0], 0);

        int answer = 2 * nodes[X].bestLeaf.wayFromRoot;
        Node currNode = nodes[X];
        int steps = 0;
        while (currNode.parent != null){
            currNode = currNode.parent;
            steps++;
            if (steps < currNode.wayFromRoot){
                answer = Math.max(answer, 2 * currNode.bestLeaf.wayFromRoot);
            } else {
                break;
            }
        }
        out.println(answer);
    }

    private void DFS(Node node, int distFromRoot) {
        node.visited = 1;
        node.wayFromRoot = distFromRoot;
        for (Node node1 : node.neigh){
            if (node1.visited == 0){
                node1.parent = node;
                DFS(node1, distFromRoot+1);
                if (node.maxWayToLeaf < node1.maxWayToLeaf + 1) {
                    node.maxWayToLeaf = node1.maxWayToLeaf + 1;
                    node.bestLeaf = node1.bestLeaf;
                }
            }
        }
    }

}