#include<bits/stdc++.h>
#define L(i, j, k) for(int i = j, i##E = k; i <= i##E; i++)
#define R(i, j, k) for(int i = j, i##E = k; i >= i##E; i--)
#define ll long long
#define ull unsigned long long
#define db double
#define pii pair<int, int>
#define mkp make_pair
using namespace std;
const int N = 2e5 + 7;
const int K = 18;
inline int read() {
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') { if(ch == '-') f = -1; ch = getchar(); }
	while('0' <= ch && ch <= '9') x = x * 10 + (ch ^ '0'), ch = getchar();
	return x * f;
}
int n, m, k;
int ans, dis[K][K], dp[K][1 << K], c[N];
vector<int> e[N];
int d[N];
void bfs(int s) {
	memset(d, 0x3f, sizeof(d));
	d[s] = 0;
	queue<int> q;
	q.push(s);
	while(!q.empty()) {
		int u = q.front();
		q.pop();
		for(int v : e[u]) 
			if(d[v] > d[u] + 1) d[v] = d[u] + 1, q.push(v);
	}
}
int main() {
	n = read(), m = read();
	L(i, 1, m) {
		int u = read(), v = read();
		e[u].push_back(v);
		e[v].push_back(u);
	}
	
	k = read();
	
	L(i, 1, k) c[i] = read();
	
	L(i, 1, k) {
		bfs(c[i]);
		L(j, 1, k) dis[i][j] = d[c[j]];
	}
	
	memset(dp, 0x3f, sizeof(dp));
	
	L(i, 1, k) dp[i][1 << (i - 1)] = 1;
	L(i, 1, (1 << k) - 1) L(j, 1, k) if(i >> (j - 1) & 1) 
		L(t, 1, k) if(! (i >> (t - 1) & 1)) dp[t][i | (1 << (t - 1))] = min(dp[t][i | (1 << (t - 1))], dp[j][i] + dis[j][t]);
	int ans = 1e9;
	L(i, 1, k) ans = min(ans, dp[i][(1 << k) - 1]);
	if(ans > 1e8) puts("-1");
	else printf("%d\n", ans);
	return 0;
} 
//Bismillahirrahmanirrahim

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define int long long
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo inf = 1000000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 100005;
const lo mod = 1000000007;

int n,m,b[li],a[19],k,flag,t,vis[li],dp[19][li],dpp[19][19][(1<<17)+2],us[19];
int cev;
string s;
queue<pair<int,int>> q;
vector<int> v[li];

inline int f(int bir,int son,int mask){
	//~ cout<<mask<
	//~ cout<<bir<<" :: "<<son<<endl;
	int cevv=inf;
	if(mask==(1<<k)-1){
		//~ if(k>2)return dp[a[bir]][a[son]];
		return 0;
	}
	if(~dpp[bir][son][mask])return dpp[bir][son][mask];
	for(int i=0;i<k;i++){
		if((mask&(1<<i)))continue;
		if(mask==0){
			cevv=min(cevv,f(i,i,mask|us[i]));
		}
		else{
			if(dp[son][a[i]]!=inf)
			cevv=min(cevv,f(bir,i,mask|us[i])+dp[son][a[i]]);
		}
	}
	return dpp[bir][son][mask]=cevv;
}

int32_t main(void){
	memset(dpp,-1,sizeof(dpp));
	scanf("%lld %lld",&n,&m);
	for(int i=1;i<=m;i++){
		int x,y;
		scanf("%lld %lld",&x,&y);
		v[x].pb(y);
		v[y].pb(x);
	}
	scanf("%lld",&k);
	for(int i=0;i<k;i++){
		scanf("%lld",&a[i]);
		for(int j=1;j<=n;j++){
			vis[j]=0;
			dp[i][j]=inf;
		}
		q.push({a[i],0});
		while(q.size()){
			int co=q.front().se;
			int node=q.front().fi;
			q.pop();
			if(vis[node])continue;
			vis[node]=1;
			dp[i][node]=co;
			for(auto go:v[node]){
				q.push({go,co+1});
			}
		}
	}
	for(int i=0;i<k;i++)us[i]=(1<<i);
	cev=f(0,0,0)+1;
	if(cev>inf)cev=-1;
	printf("%lld\n",cev);
	return 0;
}

