#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll> ;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const ll inf=1LL<<60;
ll min(ll a,ll b){return a>=b ? b:a;}
ll max(ll a,ll b){return a>=b ? a:b;}

ll dist[20][20];
ll k;
vector<ll> G[100009];
vector<ll> C;

void bfs(ll st,ll cnt){
    vector<ll> cost(100009,inf);
    queue<ll> q;
    cost[st]=0;
    q.push(st);
    while (!q.empty()){
        ll x=q.front();q.pop();
        for (ll i:G[x]){
            if (cost[i]>cost[x]+1){
                cost[i]=cost[x]+1;
                q.push(i);
            }
        }
    }
    rep(i,k){
        dist[cnt][i]=cost[C[i]];
    }
}

int main(){
    ll n,m;
    cin >> n >> m;
    rep(i,m){
        ll a,b;cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    cin >> k;
    C.resize(k);
    rep(i,k){
        ll c;cin >> c;
        c--;C[i]=c;
    }
    rep(i,k){
        bfs(C[i],i);
    }
    //rep(i,k) rep(j,k) cout << dist[i][j] << endl;
    vector<vector<ll>> dp(1<<k,vector<ll>(k,inf));
    rep(i,k){
        dp[1<<i][i]=1;
    }
    for (ll bit=1;bit<(1<<k);++bit){
        rep(i,k){
            if (bit&(1<<i)){
                ll pbit=bit^(1<<i);
                rep(j,k){
                    dp[bit][i]=min(dp[bit][i],dp[pbit][j]+dist[i][j]);
                }
            }
        }
    }
    ll ans=inf;
    rep(i,k) ans=min(ans,dp[(1<<k)-1][i]);
    if (ans==inf) ans=-1;
    cout << ans << endl;
}



#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <math.h>
#include <random>
#include <chrono>
#include <assert.h>
using namespace std ;
using ll = long long ;
using ld = long double ;
template<class T> using V = vector<T> ;
template<class T> using VV = V<V<T>> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
ll mod = 1000000007 ;
long double pie = acos(-1) ;
ll INF = 1e18 ;
 
void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
ll extGCD(ll a,ll b,ll &x,ll &y){
    if(b==0){
        x = 1 ;
        y = 0 ;
        return a ;
    }
    ll d = extGCD(b,a%b,y,x) ;
    y -= a/b*x ;
    return d ;
}
void fix_cout(){cout << fixed << setprecision(20) ;}
template<class T> void chmax(T &a,T &b){if(a<b) a = b ;}
template<class T> void chmin(T &a,T &b){if(a>b) a = b ;}

int n,m,k ;

ll calc(VV<ll> &dp,VV<int> &dis,int cur,int p){
	if(~(cur>>p)&1) return INF ;
	if(dp[cur][p]!=-1){
		// cout << cur << " " << p << " " << dp[cur][p] << endl ;
		return dp[cur][p] ;
	}
	ll num = INF ;
	for(int i=0;i<k;i++){
		if((cur>>i)&1){
			num = min(num,calc(dp,dis,cur-(1<<p),i)+dis[i][p]) ;
		}
	}
	// cout << cur << " " << p << " " << num << endl ;
	dp[cur][p] = num ;
	return num ;
}

int main(){
	cin >> n >> m ;
	VV<int> g(n) ;
	for(int i=0;i<m;i++){
		int a,b ; 
		cin >> a >> b ;
		a-- ; b-- ;
		g[a].push_back(b) ;
		g[b].push_back(a) ;
	}
	auto BFS = [&](V<int> &d,int s){
		queue<pair<int,int>> q ;
		q.emplace(0,s) ;
		while(!q.empty()){
			int p = q.front().second ;
			int cost = q.front().first ;
			q.pop() ;
			if(d[p]!=-1) continue ;
			d[p] = cost ;
			for(auto i:g[p]) q.emplace(cost+1,i) ;
		}
	} ;
	cin >> k ;
	V<int> c(k) ;
	for(auto &i:c) cin >> i ;
	for(auto &i:c) i-- ;
	V<int> d(n,-1) ;
	BFS(d,c[0]) ;
	for(auto i:c) if(d[i]==-1){
		cout << -1 << endl ;
		return 0 ;
	}
	// for(auto i:d) cout << i << " " ; cout << endl ;
	VV<int> dis(k,V<int>(k,-1)) ;
	for(int i=0;i<k;i++) dis[0][i] = d[c[i]] ;
	for(int i=1;i<k;i++){
		d = V<int>(n,-1) ;
		BFS(d,c[i]) ;
		for(int j=0;j<k;j++) dis[i][j] = d[c[j]] ;
	}
	VV<ll> dp(1<<k,V<ll>(k,-1)) ;
	for(int i=0;i<k;i++) dp[1<<i][i] = 1 ;
	ll ans = INF ;
	for(int i=0;i<k;i++) ans = min(ans,calc(dp,dis,(1<<k)-1,i)) ;
	cout << ans << endl ;
}