#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

template<class T>
bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template<class T>
bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<int, int>;
using vvi = vector<vector<int>>;
using vi = vector<int>;

const ll MOD = 1e9 + 7;
const int INF = 1001001001;
const double PI = 3.14159265358979323846;


void solve() {
    int n, m, k;
    cin >> n >> m;
    vvi G(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    cin >> k;
    vector<int> C(k);
    rep(i, k) {
        int c;
        cin >> c;
        c--;
        C[i] = c;
    }

    vvi cost(k);
    auto bfs = [&](int start) {
        vector<int> mindist(n, INF);
        queue<P> q;
        q.push(make_pair(start, 0));
        mindist[start] = 0;
        while (!q.empty()) {
            auto now = q.front(); q.pop();
            for (auto next : G[now.first]) {
                int nd = now.second + 1;
                if (mindist[next] <= nd) continue;
                mindist[next] = nd;
                q.push(make_pair(next, nd));
            }
        }
        vector<int> res(k);
        rep(i, k) res[i] = mindist[C[i]];
        return res;
    };

    rep(i, k) cost[i] = bfs(C[i]);

    vector<vector<ll>> dp(1<<k, vector<ll>(k, INF));
    rep(i, k) dp[1<<i][i] = 1;
    
    for (int x = 0; x < (1<<k); x++) {
        rep(to, k) {
            rep(from, k) {
                if (x != 0 && !(x & (1<<from))) continue;
                if ((x & (1<<to)) == 0) {
                    if (to != from) {
                        chmin(dp[x|(1<<to)][to], dp[x][from] + cost[from][to]);
                    }
                }
            }
        }
    }
    ll ans = INF;
    rep(i, k) chmin(ans, dp[(1<<k)-1][i]);
    if (ans == INF) cout << -1 << endl;
    else cout << ans << endl;
}

int main() {

    solve();

    return 0;
}

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#define int long long
namespace do_while_true {
	#define ld double
	#define ll long long
	#define re register
	#define pb push_back
	#define fir first
	#define sec second
	#define pp std::pair<int, int>
	#define mp std::make_pair
	const ll mod = 1000000007;
	template <typename T>
	inline T Max(re T x, re T y) { return x > y ? x : y; }
	template <typename T>
	inline T Min(re T x, re T y) { return x < y ? x : y; }
	template <typename T>
	inline T Abs(re T x) {	return x < 0 ? -x : x; }
	template <typename T>
	inline void read(re T& r) {
		r = 0; bool w = 0; char ch = getchar();
		while(ch < '0' || ch > '9') w = ch == '-' ? 1 : 0, ch = getchar();
		while(ch >= '0' && ch <= '9') r = r * 10 + (ch ^ 48), ch = getchar();
		r = w ? -r : r;
	}
	template <typename T>
	inline T qpow(re T x, re T y) {
		re T sumq = 1; x %= mod;
		while(y) {
			if(y&1) sumq = sumq * x % mod;
			x = x * x % mod;
			y >>= 1;
		}
		return sumq;
	}
}
using namespace do_while_true;

const int N = 100010;
const int INF = 0x3f3f3f3f;

int n, m, k, ent, head[N];
bool vis[N];
int c[N], cost[18][18], dis[N], f[300000][18];
struct Edge {
	int next, to;
}e[N << 1];
inline void add(int x, int y) {
	e[++ent].to = y; e[ent].next = head[x]; head[x] = ent;
}

std::priority_queue< pp >q;

void Dij(int p) {
	for(int i = 1; i <= n; ++i) vis[i] = 0, dis[i] = INF;
	dis[c[p]] = 0; q.push(mp(0, c[p]));
	while(!q.empty()) {
		int x = q.top().sec; q.pop();
		if(vis[x]) continue;
		vis[x] = 1;
		for(int i = head[x]; i; i = e[i].next) {
			int v = e[i].to;
			if(dis[v] > dis[x] + 1) {
				dis[v] = dis[x] + 1;
				q.push(mp(-dis[v], v));
			}
		}
	}
	for(int i = 1; i <= k; ++i) cost[p][i] = dis[c[i]];
}
inline int lowbit(int x) { return x & (-x); }

void solve() {
	read(n); read(m);
	for(int i = 1, x, y; i <= m; ++i) {
		read(x); read(y);
		add(x, y); add(y, x);
	}
	read(k); for(int i = 1; i <= k; ++i) read(c[i]);
	for(int i = 1; i <= k; ++i)	
		Dij(i);
	for(int i = 0; i < (1 << k); ++i) {
		for(int j = 1; j <= k; ++j) f[i][j] = INF;
		if(i - lowbit(i) == 0) {
			for(int j = 1; j <= k; ++j)
				if((1 << (j-1)) & i)
					f[i][j] = 1;
		}
		else {
			for(int j = 1; j <= k; ++j)
				if((1 << (j-1)) & i) {
					for(int l = 1; l <= k; ++l)
						f[i][j] = Min(f[i][j], f[i- (1 << (j-1))][l] + cost[l][j]);
				}
		}
	}
	int ans = INF;
	for(int i = 1; i <= k; ++i)
		ans = Min(ans, f[(1 << k)-1][i]);
	if(ans == INF) puts("-1");
	else printf("%lld\n", ans);
}

signed main() {
	#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	#endif
//	freopen("out1.txt", "w", stdout);
	int T = 1;
//	read(T);
	while(T--)
		solve();
	fclose(stdin);	
	return 0;
}