#include <bits/stdc++.h>          
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repp(i, st, en) for (ll i = (ll)st; i < (ll)(en); i++)
#define repm(i, st, en) for (ll i = (ll)st; i >= (ll)(en); i--)
#define all(v) v.begin(), v.end()
void chmax(ll &x, ll y) {x = max(x,y);}
void chmin(ll &x, ll y) {x = min(x,y);}
void Yes() {cout << "Yes" << endl; exit(0);}
void No() {cout << "No" << endl; exit(0);}
template<class in_Cout> void Cout(in_Cout x) {cout << x << endl; exit(0);}
template<class in_vec_cout>
void vec_cout(vector<in_vec_cout> vec) {
    for (in_vec_cout res : vec) {cout << res << " ";}
    cout << endl;
}

const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll maxN = 110000;

ll N, M, K;
vector<ll> G[maxN];
vector<ll> C;
vector<vector<ll>> dist;

void init() {
    cin >> N >> M;
    rep(i,M) {
        ll x, y; cin >> x >> y;
        x--; y--;
        G[x].push_back(y);
        G[y].push_back(x);
    }
    cin >> K;
    C.resize(K);
    rep(i,K) cin >> C[i];
    rep(i,K) C[i]--;
    dist.resize(K,vector<ll>(K));
}

vector<ll> bfs(ll st) {
    vector<ll> tmp(N,inf);
    tmp[st] = 0;
    queue<ll> que;
    que.push(st);
    while (que.size()) {
        ll x = que.front();
        que.pop();
        for (ll y : G[x]) {
            if (tmp[y]!=inf) continue;
            tmp[y] = tmp[x] + 1;
            que.push(y);
        }
    }
    vector<ll> res(K);
    rep(i,K) res[i] = tmp[C[i]];
    return res;
}

int main() {
    init();
    rep(i,K) dist[i] = bfs(C[i]);
    vector<vector<ll>> dp(1<<K,vector<ll>(K,inf));
    rep(i,K) dp[1<<i][i] = 1;
    rep(bit,1<<K) {
        if (bit==0) continue;
        rep(i,K) {
            if (!((bit>>i)&1)) continue;
            rep(j,K) {
                if ((bit>>j)&1) continue;
                ll nbit = bit | (1<<j);
                chmin(dp[nbit][j], dp[bit][i] + dist[i][j]);
            }
        }
    }
    ll X = (1<<K) - 1;
    ll ans = inf;
    rep(i,K) chmin(ans,dp[X][i]);
    if (ans==inf) ans = -1;
    Cout(ans);
}
#include<bits/stdc++.h>
using namespace std;
const long long maxn=2e5+5;
const long long maxm=20;
const long long inf=0x3f3f3f3f;
vector<long long> g[maxn];
queue<pair<long long,long long> >q;
bool vis[maxn];
long long n,m,k,c[maxm],idx[maxn];
long long dist[maxm][maxm],dp[maxm][1<<maxm];
int main(){
	cin>>n>>m;
	for(long long i=0;i<m;i++)
	{
		long long x,y;
		cin>>x>>y;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	cin>>k;
	memset(idx,-1,sizeof(idx));
	for(long long i=0;i<k;i++)
	{
		cin>>c[i];
		idx[c[i]]=i;
	}
	for(long long i=0;i<k;i++)
	{
		q.push({c[i],0});
		memset(vis,0,sizeof(vis));
		for(long long j=0;j<k;j++)
			dist[i][j]=maxn;
		while(!q.empty())
		{
			auto cur=q.front();
			q.pop();
			long long node=cur.first,cost=cur.second;
			if(vis[node])
				continue;
			vis[node]=1;
			if(idx[node]!=-1)
				dist[i][idx[node]]=cost;
			for(long long nbr:g[node])
			{
				if(!vis[nbr])
					q.push({nbr,cost+1});
			}
		}
	}
//	cout<<"11111111111"<<endl;
//	for(int i=0;i<k;i++)
//	{
//		for(int j=0;j<k;j++)
//			cout<<dist[i][j]<<" ";
//		cout<<endl;
//	}
	memset(dp,maxn,sizeof(dp));
	for(long long i=0;i<k;i++)
		dp[i][1<<i]=0;
	for(long long j=0;j<(1<<k);j++)
	{
		for(long long i=0;i<k;i++)
		{
			if(j&(1<<i))
			{
				long long cur=j&~(1<<i);
				for(long long l=0;l<k;l++)
					if(cur&(1<<l))
						dp[i][j]=min(dp[i][j],dp[l][cur]+dist[l][i]);
			}
		}
	}
//	cout<<"11111111111"<<endl;
//	for(int i=0;i<k;i++)
//	{
//		for(int j=0;j<k;j++)
//			cout<<dp[i][j]<<" ";
//		cout<<endl;
//	}
	long long ans=maxn;
	for(long long i=0;i<k;i++)
		ans=min(ans,dp[i][(1<<k)-1]);
	if(ans==maxn)
		cout<<"-1"<<endl;
	else
		cout<<ans+1<<endl;
	return 0;
}