#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define int long long
#define inf 1e15
#define pii pair<int,int>
#define fi first
#define se second
int dis[17][17];
int dp[(1<<17)][17];
int k;
int fun(int mask,int i){
	if(__builtin_popcount(mask)==1 && mask&(1<<i))return 1;
	if(dp[mask][i]!=-1)return dp[mask][i];
	int a=inf;
	int sub=mask^(1<<i);
	for(int j=0;j<k;j++){
		if(sub&(1<<j))a=min(a,fun(sub,j)+dis[j][i]);
	}
	return dp[mask][i]=a;
}
signed main(){
    fastio
	int n,m;
	cin>>n>>m;
	vector<vector<int>> adj(n);
	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		--x;--y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	cin>>k;
	int c[k];
	for(int i=0;i<k;i++){
		int x;
		cin>>x;
		--x;
		c[i]=x;
	}
	for(int i=0;i<k;i++){
		int dist[n];
		memset(dist,-1,sizeof dist);
		dist[c[i]]=0;
		queue<int> q;
		q.push(c[i]);
		while(!q.empty()){
			int v=q.front();
			q.pop();
			for(int u:adj[v]){
				if(dist[u]!=-1)continue;
				dist[u]=dist[v]+1;
				q.push(u);
			}
		}
		for(int j=0;j<k;j++){
		    if(dist[c[j]]==-1){cout<<"-1";return 0;}
			dis[i][j]=dist[c[j]];
		}
	}

	memset(dp,-1,sizeof dp);

	int ans=inf;
	for(int i=0;i<k;i++)ans=min(ans,fun((1<<k)-1,i));
	cout<<ans;
   	return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=1000000007;
constexpr ll INF=1e18;

VVI edge(110000,VI(0));
VI d(110000,INF);

void dijkstra(int s){
    priority_queue<P,vector<P>,greater<P>> que;
    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 to:edge[v]){
            if(d[to]>d[v]+1){
                d[to]=d[v]+1;
                que.push(P(d[to],to));
            }
        }
    }
}

VVI kdist(18,VI(18,INF));
VI kd(5000000,INF);
int M=270000;
int k;

ll dijkstra2(){
    priority_queue<P,vector<P>,greater<P>> que;
    REP(i,k){
        kd[i*M+(1<<i)]=0;
        que.push(P(0,i*M+(1<<i)));
    }
    ll ans=INF;
    while(!que.empty()){
        P p=que.top();
        que.pop();
        int v=p.second/M;
        int w=p.second%M;
        if(kd[p.second]<p.first) continue;
        if(w==(1<<k)-1){
            ans=min(ans,kd[p.second]);
            continue;
        }
        REP(i,k){
            int to=i*M+(w|(1<<i));
            if(kd[to]>kd[p.second]+kdist[v][i]){
                kd[to]=kd[p.second]+kdist[v][i];
                que.push(P(kd[to],to));
            }
        }
    }
    return (ans==INF?-1:ans+1);
}

int main(){
    int n, m; cin >> n >> m;
    int a, b;
    REP(i,m){
        cin >> a >> b;
        a--, b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    cin >> k;
    VI c(k);
    REP(i,k) cin >> c[i], c[i]--;
    REP(i,k){
        dijkstra(c[i]);
        REP(j,k) kdist[i][j]=d[c[j]];
        REP(j,n) d[j]=INF;
    }
    cout << dijkstra2() << endl;
    return 0;
}