#include <bits/stdc++.h>
using namespace std;

const int K = 18;
const int N = 100005;
const int INF = 1e9;

int n, m;
vector<int> edges[N];
int k;
int c[K];

int dist[K][N];

void bfs(int u, int dist[]) {
  queue<int> q;
  for (int i = 0; i < n; ++i) dist[i] = -1;

  q.push(u);
  dist[u] = 0;
  while (q.size()) {
    int u = q.front();
    q.pop();

    for (int v : edges[u]) {
      if (dist[v] != -1) continue;
      dist[v] = dist[u] + 1;
      q.push(v);
    }
  }
}

int dp[K][1 << K];
int f(int x, int mask) {
  if ((mask + 1) == (1 << k)) return 0;
  if (~dp[x][mask]) return dp[x][mask];

  int ret = INF;
  for (int i = 0; i < k; ++i) {
    if (mask >> i & 1) continue;
    if (dist[x][c[i]] == -1) continue;
    ret = min(ret, dist[x][c[i]] + f(i, mask | 1 << i));
  }

  return dp[x][mask] = ret;
}

int solve() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    --u, --v;

    edges[u].push_back(v);
    edges[v].push_back(u);
  }

  scanf("%d", &k);
  for (int i = 0; i < k; ++i) {
    scanf("%d", &c[i]);
    --c[i];

    bfs(c[i], dist[i]);
  }

  memset(dp, -1, sizeof dp);

  int ans = INF;
  for (int i = 0; i < k; ++i) {
    ans = min(ans, 1 + f(i, 1 << i));
  }

  if (ans >= INF) ans = -1;
  printf("%d\n", ans);
  return 0;
}

int main() {
  int t = 1;
  // scanf("%d", &t);
  for (int tc = 0; tc < t; ++tc) {
    solve();
  }
  return 0;
}

#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll n,m,k,c[maxn],d[25][25],dis[25][maxn],dp[25][maxn],vis[maxn],pos[maxn];
queue <int> q;
vector <int> mp[maxn];

inline void wk(int nw,int s)
{
	rep(i,1,n) vis[i]=0; vis[s]=1; dis[nw][s]=0; q.push(s);
	while(!q.empty())
	{
		int u=q.front(); q.pop();
		for(int i=0;i<mp[u].size();i++)
		{
			int v=mp[u][i]; if(vis[v]) continue;
			dis[nw][v]=dis[nw][u]+1;
			if(pos[v]) d[nw][pos[v]]=dis[nw][v];
			vis[v]=1; q.push(v);
		}
	}
}

int main()
{
	n=read(); m=read();
	rep(i,1,m)
	{
		int u=read(),v=read();
		mp[u].pb(v); mp[v].pb(u);
	}
	rep(i,1,20) rep(j,1,n) dis[i][j]=inf;
	k=read(); rep(i,1,k) c[i]=read(),pos[c[i]]=i;
	
	rep(i,1,k) rep(j,1,k) if(i!=j) d[i][j]=inf;
	rep(i,1,k) wk(i,c[i]);
	
	int ed=(1<<k)-1;
	rep(i,0,k) rep(j,0,ed) dp[i][j]=inf;
	
	dp[0][0]=0;
	rep(i,1,k) d[0][k]=1,d[k][0]=1;
	rep(i,1,k) dp[i][1<<(i-1)]=1;
	
	rep(i,1,ed)
	{
		rep(j,1,k)
		{
			if(i&(1<<(j-1)))
			{
				rep(K,1,k)
				{
					if(!(i&(1<<(K-1))))
						dp[K][i|(1<<(K-1))]=min(dp[K][i|(1<<(K-1))],dp[j][i]+d[j][K]);
				}
			}
		}
	}
	
	ll ans=inf;
	rep(i,1,k) ans=min(ans,dp[i][ed]);
	if(ans==inf) puts("-1");
	else cout<<ans<<endl;
	
	return 0;
}