#include<bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int N = 1e5+20;
const int M = 19;
int dis[M][N];
int vis[N];
vector<int> G[N];
int n,m,k,C[N],f[N*2][M];
priority_queue<pair<int,int> >q;
void dij(int *dis,int x)
{
	for(int i=1;i<=n;i++)dis[i]=inf,vis[i]=0;
	dis[x] = 0;
	q.push(make_pair(0,x));
	while(!q.empty())
	{
		int u=q.top().second;q.pop();
		if(vis[u]) continue;
		vis[u] = 1;
		for(int v:G[u])if(dis[v]>dis[u]+1)
		{
			dis[v] = dis[u]+1;
			q.push(make_pair(-dis[v],v));
		}
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1,x,y;i<=m;i++)
		scanf("%d%d",&x,&y),G[x].push_back(y),
		G[y].push_back(x);
	scanf("%d",&k);
	for(int i=0;i<k;i++)
		scanf("%d",&C[i]),dij(dis[i],C[i]);
	int M = 1<<k;
	for(int i=0;i<M;i++)
		for(int j=0;j<k;j++)f[i][j] = inf;
	for(int i=0;i<k;i++)
		f[1<<i][i]=1; 
	for(int i=1;i<M-1;i++)for(int l=0;l<k;l++)if(f[i][l]!=inf)
	{
		for(int j=0;j<k;j++)
			if(((i>>j)&1)==0)
			{
				int d = dis[l][C[j]];
				f[i|(1<<j)][j]= min(f[i|(1<<j)][j],f[i][l]+d);
			}
	}
	int ans = inf;
	for(int i=0;i<k;i++) ans = min(ans,f[M-1][i]);
	printf("%d",ans==inf?-1:ans);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
struct edge{int to; ll cost;};
using P = pair<ll,int>;
const ll INF = 1e17;

void dijkstra(int n, int s, vector<vector<edge>>& g, vector<ll>& d){
  priority_queue<P,vector<P>,greater<P>> que;
  rep(i,n) d[i] = INF;
  d[s] = 0;
  que.push(P(0,s));
  while(!que.empty()){
    P p = que.top();
    que.pop();
    int v = p.second;
    if(d[v] < p.first) continue;
    for(auto e : g[v]){
      if(d[e.to] > d[v] + e.cost){
        d[e.to] = d[v] + e.cost;
        que.push(P(d[e.to], e.to));
      }
    }
  }
}

int main(){
  int n, m;
  cin >> n >> m;
  int a[m], b[m];
  vector<vector<edge>> g(n);
  rep(i,m) {
    cin >> a[i] >> b[i];
    a[i]--; b[i]--;
    g[a[i]].push_back(edge{b[i],1});
    g[b[i]].push_back(edge{a[i],1});
  }
  int k;
  cin >> k;
  int c[k];
  rep(i,k) {
    cin >> c[i];
    c[i]--;
  }
  vector<vector<ll>> dist(k,vector<ll>(k,INF));
  rep(i,k) {
    vector<ll> d(n);
    dijkstra(n,c[i],g,d);
    rep(j,k) dist[i][j] = d[c[j]];
  }
  vector<vector<ll>> dp(1<<k,vector<ll>(k,INF));
  rep(i,k) dp[1<<i][i] = 1;
  rep(bit,1<<k) rep(j,k) rep(l,k) dp[(1<<l)|bit][l] = min(dp[(1<<l)|bit][l],dp[bit][j]+dist[j][l]);
  ll ans = INF;
  rep(i,k) ans = min(ans,dp[(1<<k)-1][i]);
  cout << (ans == INF ? -1 : ans) << endl;
  return 0;
}
