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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.Collection;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.util.Queue;
import java.util.LinkedList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author phantom11
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt(), i, x = in.nextInt() - 1;
            Node graph[] = new Node[n];
            for (i = 0; i < n; i++) {
                graph[i] = new Node(i);
            }
            for (i = 1; i < n; i++) {
                int u = in.nextInt() - 1, v = in.nextInt() - 1;
                graph[u].children.add(graph[v]);
                graph[v].children.add(graph[u]);
            }
            int distanceFromAlice[] = bfs(0, graph);
            int distanceFromBob[] = bfs(x, graph);
            int ans = 0;
            //DebugUtils.debug(distanceFromAlice, distanceFromBob);
            for (i = 0; i < n; i++) {
                if (graph[i].isLeaf && distanceFromAlice[i] > distanceFromBob[i]) {
                    ans = Math.max(ans, 2 * distanceFromAlice[i]);
                }
            }
            out.printLine(ans);
        }

        public int[] bfs(int start, Node graph[]) {
            Queue<Integer> queue = new LinkedList<>();
            queue.add(start);
            int n = graph.length;
            boolean visited[] = new boolean[n];
            int height[] = new int[n];
            height[start] = 0;
            visited[start] = true;
            while (!queue.isEmpty()) {
                int u = queue.poll();
                boolean isLeaf = true;
                for (Node child : graph[u].children) {
                    if (!visited[child.index]) {
                        isLeaf = false;
                        visited[child.index] = true;
                        queue.add(child.index);
                        height[child.index] = height[u] + 1;
                    }
                }
                if (start == 0 && isLeaf) {
                    graph[u].isLeaf = true;
                }
            }
            return height;
        }

        class Node {
            ArrayList<Node> children;
            int index;
            boolean isLeaf;

            public Node(int index) {
                children = new ArrayList<>();
                this.index = index;
            }

        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tokenizer = null;

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(in.readLine());
                }
                return tokenizer.nextToken();
            } catch (IOException e) {
                return null;
            }
        }

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

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}

