#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

struct State{
    int at;
    ll cost;
    State(int a, ll c) : at(a), cost(c){}
    bool operator>(const State& s) const{
        return cost > s.cost;
    }
};

struct Edge{
    int to;
    ll cost;
    Edge(int t, ll c) : to(t), cost(c){}
};

using Graph = vector<vector<Edge> >;
const ll INF = 1e15;

void dijkstra(int s, const Graph& G, vector<ll>& minc){
    minc.assign(G.size(), INF);
    priority_queue<State, vector<State>, greater<State> > pq;
    pq.emplace(s, 0);
    minc[s] = 0;
    while(!pq.empty()){
        State cur = pq.top();
        pq.pop();
        if(minc[cur.at] < cur.cost) continue;
        for(const Edge& e : G[cur.at]){
            ll cost = cur.cost + e.cost;
            if(minc[e.to] <= cost) continue;
            minc[e.to] = cost;
            pq.emplace(e.to, cost);
        }
    }
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<int> a(m), b(m);
	Graph g1(n);
	rep(i,m){
		cin >> a[i] >> b[i];
		--a[i];
		--b[i];
		g1[a[i]].emplace_back(b[i], 1);
        g1[b[i]].emplace_back(a[i], 1);
	}
	int k;
	cin >> k;
	vector<int> c(k);
	vector<vector<ll>> minc(k);
	rep(i,k){
		cin >> c[i];
		--c[i];
		dijkstra(c[i], g1, minc[i]);
	}
	ll ans = INF;
	vector<vector<ll>> dp((1<<k), vector<ll>(k, INF));
	rep(i,k) dp[0][i] = 1;
	rep(S,(1<<k)){
		rep(i,k){
			rep(j,k){
				if(S>>j & 1) continue;
				int nextS = S + (1<<j);
				ll cost = dp[S][i] + minc[i][c[j]];
				chmin(dp[nextS][j], cost);
			}
		}
	}
	rep(j,k) chmin(ans, dp[(1<<k)-1][j]);
	if(ans == INF) ans = -1;
	cout << ans << endl;
	return 0;
}
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
const int INF = (1u<<30) - 1;

struct BFS
{
	int V;
	const vector<vector<int>> &g;
	int s;
	vector<int> dist;
	vector<int> previous;

	BFS(const vector<vector<int>> &g) : V(g.size()), g(g) {}

	void calc(int start) {
		s = start;
		dist.assign(V, INF);
		previous.assign(V, -1);
		dist[s] = 0;
		queue<int> que;
		que.push(s);
		while (!que.empty()) {
			int v = que.front(); que.pop();
			for (int nv : g[v]) {
				if (dist[nv] != INF) continue;
				dist[nv] = dist[v] + 1;
				previous[nv] = v;
				que.push(nv);
			}
		}
	}
};

int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>> g(n);
	for (int i = 0; i < m; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	int k;
	cin >> k;
	vector<int> C(k);
	for (int i = 0; i < k; i++) {
		cin >> C[i];
		C[i]--;
	}
	vector<vector<int>> dmatrix(k, vector<int>(k, INF));
	BFS bfs(g);
	for (int i = 0; i < k; i++) {
		bfs.calc(C[i]);
		for (int j = 0; j < k; j++) {
			dmatrix[i][j] = bfs.dist[C[j]];
		}
	}
	int p = 1 << k;
	vector<vector<int>> dp(p, vector<int>(k, INF));
	for (int v = 0; v < k; v++) dp[0][v] = 0;
	for (int i = 0; i < p; i++) {
		for (int v = 0; v < k; v++) {
			for (int u = 0; u < k; u++) {
				dp[i][v] = min(dp[i][v], dp[i & (~(1<<v))][u] + dmatrix[v][u]);
			}
		}
	}
	int ans = INF;
	for (int i = 0; i < k; i++) {
		ans = min(ans, dp[p-1][i]);
	}
	ans++;
	if (ans >= INF) ans = -1;
	cout << ans << endl;
	return 0;
}