#include<bits/stdc++.h>
#define ll long long
#define N 200005
using namespace std;
int read() {
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while('0'<=c&&c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}
int n,m,K,cnt,h[N],c[N],fp[N];
struct Edge {
	int to,next;
}a[N*2];
void Add(int x,int y) {
	cnt++;a[cnt].to = y;a[cnt].next = h[x];h[x] = cnt;
}
bool vst[N];
int ind,ans = 0;
#define inf 0x7fffffff/2
queue<int>q;
int d[20][N],inq[N];
void bfs(int id) {
	for(int i=1; i<=n; ++i)d[id][i] = inf;
	q.push(c[id]);d[id][c[id]] = 0;
	inq[c[id]] = 1;
	while(!q.empty()) {
		int x = q.front();q.pop();
		for(int i=h[x]; i; i=a[i].next) {
			int y = a[i].to;
			if(!inq[y])d[id][y] = d[id][x]+1,q.push(y),inq[y] = 1;
		}
	}
	memset(inq,0,sizeof(inq));
}
int sta,f[1<<17][18];;
void deal() {
	for(int i=1; i<=K; ++i)bfs(i);
//	for(int i=1; i<=K; ++i){ 
//		
//		for(int j=1; j<=n; ++j) 
//		cout << d[i][j] << ' ';
//		cout << '\n';
//	}
	memset(f,0x3f,sizeof(f));
	for(int i=1; i<=K; ++i)f[1<<i-1][i] = 0;
	for(int i=0;i<(1<<K);i++)
	{
		for(int j=1;j<=K;j++)
		{
			if(f[i][j]>1e9)continue;
			for(int t=1;t<=K;t++)
			{
				if(i&(1<<t-1))continue;
				f[i+(1<<t-1)][t]=min(f[i+(1<<t-1)][t],f[i][j]+d[j][c[t]]);
			}
		}
	}
	
	for(int j=1;j<=K;j++)
	{
		ans=min(ans,f[(1<<K)-1][j]);
	}

}
int main() {
	n = read();m = read();
	for(int i=1; i<=m; ++i) {
		int x = read(),y = read();
		Add(x,y);Add(y,x);
	}
	K = read();sta = 0;
	for(int i=1; i<=K; ++i) {
		sta |= 1<<i-1;
	}
	ans = inf;
	for(int i=1; i<=K; ++i)c[i] = read(),fp[c[i]] = i-1;
	deal();
	if(ans >= 1e9)puts("-1");
	else cout << ans+1;
}
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

void chmin(int& x, int y) { x = min(x,y);}
 
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> to(n);
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  int k;
  cin >> k;
  vector<int> c(k);
  rep(i,k) {
    cin >> c[i];
    c[i]--;
  }
  vector<vector<int>> dist(k,vector<int>(k));
 
  const int INF = 1001001001;
  auto bfs = [&](int sv) {
    vector<int> dist(n, INF);
    queue<int> q;
    dist[sv] = 0;
    q.push(sv);
    while (!q.empty()) {
      int v = q.front(); q.pop();
      for (int u : to[v]) {
        if (dist[u] != INF) continue;
        dist[u] = dist[v]+1;
        q.push(u);
      }
    }
    return dist;
  };
  rep(i,k) {
    vector<int> d = bfs(c[i]);
    rep(j,k) dist[i][j] = d[c[j]];
  }
 
  int k2 = 1<<k;
  vector<vector<int> > dp(k2, vector<int>(k, INF));
  rep(i,k) dp[1<<i][i] = 1;
  rep(s,k2)rep(i,k) {
    if (~s>>i&1) continue;
    rep(j,k) {
      if (s>>j&1) continue;
      chmin(dp[s|1<<j][j], dp[s][i]+dist[i][j]);
    }
  }
  int ans = INF;
  rep(i,k) chmin(ans, dp[k2-1][i]);
  if (ans == INF) cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}