#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>

#define for_n(i, n) for (int i = 0; i < (int) n; i++)

using namespace std;
using li = int;

const li INF = 0x3fffffff;

struct vertex {
    vector<li> neigh;
};


int main() {

    li n, m, a, b, k; cin >> n >> m;

    vector<vertex> vertices(n + 1);

    while (m--) {
        cin >> a >> b;
        vertices[a].neigh.push_back(b);
        vertices[b].neigh.push_back(a);
    }

    cin >> k;
    vector<li> gems(k, 0);
    for_n(i, k) cin >> gems[i];

    auto bfs = [&](int beg) {

        vector<li> costs(n + 1, INF);
        costs[beg] = 0;
        queue<li> queue;
        queue.push(beg);

        while (!queue.empty()) {
            li next = queue.front(); queue.pop();
            for (auto y : vertices[next].neigh) {
                if (costs[next] + 1 < costs[y]) {
                    costs[y] = costs[next] + 1;
                    queue.push(y);
                }
            }
        }

        vector<li> final_costs(k, 0);
        for_n(i, k) final_costs[i] = costs[gems[i]];

        return final_costs;
    };

    vector<vector<li>> dp(1 << k, vector<li>(k, INF));
    vector<vector<li>> costs(k);

    for_n(i, k) costs[i] = bfs(gems[i]);
    for (li i = 0; i < k; i++) dp[1 << i][i] = 1;
    for (li bit = 1; bit < 1 << k; bit++)
        for (li i = 0; i < k; i++)
            if (bit & 1 << i) {

                li bit2 = bit ^ 1 << i;

                for (li j = 0; j < k; j++)
                    if (bit2 & 1 << j)
                        dp[bit][i] = min(dp[bit][i], dp[bit2][j] + costs[i][j]);

            }

    li ans = *min_element(dp.back().begin(), dp.back().end());
    if(ans == INF) ans = -1;
    cout << ans << endl;


    return 0;
}

#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
const int maxn=(2e5)+10;
int n,k,mid,tot;
vector<int> g[maxn];
int mx[maxn];
void dfs(int u,int p) {
	mx[u]=0;
	for (int v : g[u]) if (v!=p) {
		dfs(v,u);
		if (mx[u]+mx[v]+1>2*mid) {
			tot++;
			mx[u]=min(mx[u],mx[v]+1);
		} else mx[u]=max(mx[u],mx[v]+1);
	}
}
bool solve() {
	tot=0;
	dfs(1,0);
	return tot+1<=k;
}
int main() {
	//freopen("1.txt","r",stdin);
	read(n),read(k); int x,y;
	for (int i=1;i<n;i++) {
		read(x),read(y);
		g[x].push_back(y),g[y].push_back(x);
	}
	int l=0,r=n,res;
	while (l<=r) {
		mid=(l+r)>>1;
		if (solve()) res=mid,r=mid-1;
		else l=mid+1;
	}
	printf("%d\n",res);
	return 0;
}
/*
  0. Enough array size? Enough array size? Enough array size? Integer overflow?
  
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Time complexity? Memory usage? Precision error?
*/