// Arup Guha
// 5/14/2023
// Solution to 2022 SER D1/D2 Problem: Branch Manager

import java.util.*;
import java.io.*;

public class branchmanager {
	
	public static int n;
	public static int[] par;
	public static TreeSet<Integer>[] g;
	
	public static void main(String[] args) throws Exception {
		
		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer tok = new StringTokenizer(stdin.readLine());
		
		n = Integer.parseInt(tok.nextToken());
		int numQ = Integer.parseInt(tok.nextToken());
		
		par = new int[n];
		g = new TreeSet[n];
		for (int i=0; i<n; i++) g[i] = new TreeSet<Integer>();

		// Get tree.
		for (int i=0; i<n-1; i++) {
			tok = new StringTokenizer(stdin.readLine());
			int a = Integer.parseInt(tok.nextToken())-1;
			int b = Integer.parseInt(tok.nextToken())-1;
			par[b] = a;
			g[a].add(b);
		}
		
		Stack<Integer> curPath = new Stack<Integer>();
		HashSet<Integer> curPathSet = new HashSet<Integer>();
		
		// Store current left path.
		int cN = 0;
		curPath.push(0); curPathSet.add(0);
		while (g[cN].size() != 0) {
			cN = g[cN].first();
			curPath.push(cN);
			curPathSet.add(cN);
		}
		
		// Will store what we can reach.
		boolean[] reachable = new boolean[n];
		Arrays.fill(reachable, true);
		
		// Read in queries...not sure if you're allowed to terminate w/o reading all input.
		int[] q = new int[numQ];
		for (int i=0; i<numQ; i++) q[i] = Integer.parseInt(stdin.readLine())-1;
		
		int res = numQ;
		for (int i=0; i<numQ; i++) {
			
			// Can't do this one...so we're done.
			if (!reachable[q[i]]) { res = i; break; }
			
			// We have to make a change to the current path.
			if (!curPathSet.contains(q[i])) {
				
				int cur = q[i];
		
				// Crawl up until we hit current path.
				while (!curPathSet.contains(cur)) {
					
					int prev = par[cur];
					
					// Kill all the children with lower numbers.
					while (g[prev].first() != cur) {
						kill(g[prev].first(), reachable);
						g[prev].pollFirst();
					}
					
					// Move up.
					cur = prev;
				}
				
				// We've merged into something on our old first path.
				while (curPath.peek() != cur) {
					curPathSet.remove(curPath.peek());
					curPath.pop();
				}
				
				// Now build back our current path.
				while (g[cur].size() != 0) {
					cur = g[cur].first();
					curPath.push(cur);
					curPathSet.add(cur);
				}
				
			}	
		} // end query loop
	
		// Ta da!
		System.out.println(res);
	}
	
	// DFS and kill all nodes in the tree rooted at u.
	public static void kill(int u, boolean[] reachable) {
		reachable[u] = false;
		for (Integer x: g[u])
			kill(x, reachable);
	}
}