#include <iostream>
#include <vector>
#include <deque>

int main()
{
    int n, m;
    std::cin >> n >> m;
    std::vector<int> parent(n);
    parent[0] = -1;
    for(int i=0; i<n-1; i++)
    {
        int a, b;
        std::cin >> a >> b;
        parent[b-1] = a-1;
    }
    
    std::vector<std::vector<int> > children(n);
    
    for(int i=1; i<n; i++)
    {
        children[parent[i]].push_back(i);
    }
    
    std::deque<int> dfs;
    int idx=0;
    dfs.push_front(0);
    std::vector<bool> visited(n);
    std::vector<int> firstindex(n);
    std::vector<int> lastindex(n);
    
    while(!dfs.empty())
    {
        int next = dfs.front();
        dfs.pop_front();
        
        if(visited[next])
            lastindex[next] = idx++;
        else
        {
            firstindex[next] = idx++;
            visited[next] = true;
            dfs.push_front(next);
            int nc = children[next].size();
            for(int i=0; i<nc; i++)
            {
                dfs.push_front(children[next][nc-i-1]);
            }
        }
    }
    
    int curmin = 0;
    
    for(int i=0; i<m; i++)
    {
        int d;
        std::cin >> d;
        
        if(lastindex[d-1] < curmin)
        {
            std::cout << i << std::endl;
            return 0;
        }
        curmin = std::max(curmin, firstindex[d-1]);
    }        
    std::cout << m << std::endl;
}
