import java.util.*;

/**
 * Team: Nulll
 * Members:
 * - Ronny Majani
 * - Ozan Onur Tek
 * Izmir Institute of Technology
 * Created by ronnymajani on 13.02.2016.
 */
public class merdopolis {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int K = in.nextInt();
        boolean[][] tree = readTree(in, N);
        int[] duraklar = readDuraklar(in, K);

        int longestLength = 0;

        for (int i = 0; i < duraklar.length; i++) {
            for (int j = i+1; j < duraklar.length; j++) {
                int tempLength = calculatePathLength(tree, duraklar[i], duraklar[j]);
                if (tempLength > longestLength)
                    longestLength = tempLength;
            }

        }
        System.out.println(longestLength);//+1 because arrays start with 0, but input starts with 1

    }

    private static int calculatePathLength(boolean[][] mainTree, int source, int dest) {
        if (source == dest) {
            return 0;
        }
        boolean[][] tree = new boolean[mainTree.length][mainTree.length];
        for(int i = 0; i < tree.length; i++)
            System.arraycopy(mainTree[i], 0, tree[i], 0, tree.length);
        ArrayList<Integer> queue = new ArrayList<>();
        int level = 1;
        int currNode = source;
        queue.add(-1);

        while(true) {
            for(int i = 0; i < tree.length; i++) {
                if(tree[currNode][i]) {
                    if (i == dest)
                        return level;
                    queue.add(i);
                }
            }

            for (int i = 0; i < tree.length; i++) {
                tree[i][currNode] = false;
            }

            try {
                if (queue.get(0) == -1) {
                    queue.remove(0);
                    currNode = queue.get(0);
                    queue.remove(0);
                    queue.add(-1);
                    level++;
                } else {
                    currNode = queue.get(0);
                    queue.remove(0);
                }
            } catch (IndexOutOfBoundsException e) {
                return level;
            }
        }
    }

    private static int[] readDuraklar(Scanner in, int k) {
        int[] busStops = new int[k];
        for (int i = 0; i < k; i++)
            busStops[i] =  in.nextInt()-1;
        return busStops;
    }


    static private boolean[][] readTree(Scanner in, int n) {
        boolean[][] tree = new boolean[n][n];
        for (int i = 0; i < n-1; i++) {//n-1 edges
            int e1, e2;
            //-1 because the input is 1->x but we want 0->x-1
            e1 = in.nextInt()-1;
            e2 = in.nextInt()-1;
            tree[e1][e2] = true;
            tree[e2][e1] = true;
        }
        return tree;
    }
}
