// Problem: 
// 			E - Magical Ornament
// 			
// 		
// Contest: AtCoder - AtCoder Beginner Contest 190
// URL: https://atcoder.jp/contests/abc190/tasks/abc190_e
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forn(i,x,n) for(int i = x;i <= n;++i)	

const int N = 1e5+7,M = 2 * N,CK = 20,INF = 0x3f3f3f3f;
int dist[CK][N],c[CK];
int edge[M],succ[M],ver[N],idx;
int f[1 << 17][CK];
void add(int u,int v)
{
	edge[idx] = v;
	succ[idx] = ver[u];
	ver[u] = idx++;
}

void bfs(int f)
{
	memset(dist[f],0x3f,sizeof dist[f]);
	queue<int> q;q.push(c[f]);dist[f][c[f]] = 0;
	while(!q.empty())
	{
		int u = q.front();q.pop();
		for(int i = ver[u];~i;i = succ[i])
		{
			int v = edge[i];
			if(dist[f][v] > dist[f][u] + 1)
			{
				dist[f][v] = dist[f][u] + 1;
				q.push(v);
			}
		}
	}
}

int main() 
{
	memset(ver,-1,sizeof ver);
	int n,m;scanf("%d%d",&n,&m);
	forn(i,1,m)
	{
		int u,v;scanf("%d%d",&u,&v);
		--u;--v;
		add(u,v),add(v,u);
	}
	
	int k;scanf("%d",&k);
	forn(i,0,k - 1)	scanf("%d",&c[i]),--c[i];
	
	forn(i,0,k - 1)	bfs(i);
	
	memset(f,0x3f,sizeof f);
	forn(i,0,k - 1)	f[1 << i][i] = 1;
	
	forn(S,1,(1 << k) - 1)
	{
		forn(j,0,k - 1)	forn(i,0,k - 1)
		{
			if(f[S][j] == INF)	continue;
			if(!(S >> j & 1) || dist[j][c[i]] == INF || (S >> i & 1))	continue;
			f[S | (1 << i)][i] = min(f[S | (1 << i)][i],f[S][j] + dist[j][c[i]]);
		}
	}
	int res = INF;
	forn(i,0,k - 1)	res = min(res,f[(1 << k) - 1][i]);
	printf("%d",res == INF ? -1 : res);
	return 0;
}
#include <cstdio>
#include <cctype>
#include <cstring>
#define rr register
using namespace std;
const int N=100011;
struct node{int y,next;}e[N<<1];
int as[N],q[N],a[18],et=1,head,ans,tail,k,dis[18][N],n,m,dp[N<<1][18],two[18];
inline signed iut(){
	rr int ans=0; rr char c=getchar();
	while (!isdigit(c)) c=getchar();
	while (isdigit(c)) ans=(ans<<3)+(ans<<1)+(c^48),c=getchar();
	return ans;
}
inline void add(int x,int y){
    e[++et]=(node){y,as[x]},as[x]=et;
    e[++et]=(node){x,as[y]},as[y]=et;
}
inline signed min(int a,int b){return a<b?a:b;}
inline void bfs(int z,int st){
	q[head=tail=1]=st,dis[z][st]=1;
	while (head<=tail){
		rr int x=q[head++];
		for (rr int i=as[x];i;i=e[i].next)
		if (!dis[z][e[i].y]){
			dis[z][e[i].y]=dis[z][x]+1;
			q[++tail]=e[i].y;
		}
	}
}
signed main(){
	n=iut(); m=iut();
	for (rr int i=1;i<=m;++i) add(iut(),iut());
	k=iut(),memset(dp,42,sizeof(dp)),two[0]=1,ans=dp[0][0];
	for (rr int i=0;i<k;++i) bfs(i,a[i]=iut());
	for (rr int i=1;i<=k;++i) two[i]=two[i-1]<<1;
	for (rr int i=0;i<k;++i) dp[two[i]][i]=0;
	for (rr int i=3;i<two[k];++i){
		for (rr int j0=0;j0<k;++j0)
		    for (rr int j1=0;j1<k;++j1)
		        if (j0!=j1&&(i&(two[j0]|two[j1]))&&dis[j0][a[j1]])
		            dp[i][j0]=min(dp[i][j0],dp[i^two[j0]][j1]+dis[j0][a[j1]]-2);
	}
	for (rr int i=0;i<k;++i) ans=min(ans,dp[two[k]-1][i]);
	if (ans==dp[0][0]) return !printf("-1"); 
	return !printf("%d",ans+k);
}