#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define int long long
#define F(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end()
#define show(A) for (auto i: A) cout << i << " "; cout << '\n';
#define show_(A, n) F(i, n) { show(A[i]) }

using namespace std;
using ld = long double;
using vi = vector < int > ;
using mi = map < int, int > ;
using pi = pair < int, int > ;

const int N = 100005;
const int MOD = 1e9 + 7;
const int inf = 1e18 + 1;
/***************************code begins here*****************************/
vector<vi> adj;
void dijkstra(int s, vector<int> & d, vector<int> & p) {
    int n = adj.size();
    d.assign(n, 1e9);
    p.assign(n, -1);

    d[s] = 0;
    set<pair<int, int>> q;
    q.insert({0, s});
    while (!q.empty()) {
        int v = q.begin()->second;
        q.erase(q.begin());

        for (auto edge : adj[v]) {
            int to = edge;
            int len = 1;

            if (d[v] + len < d[to]) {
                q.erase({d[to], to});
                d[to] = d[v] + len;
                p[to] = v;
                q.insert({d[to], to});
            }
        }
    }
}
void solve() {
    int n,m,k, ans = inf;
    cin >> n >> m;
    adj.resize(n+1);
    F(i, m){
    	int x,y;
    	cin >> x >> y;
    	adj[x].pb(y);
    	adj[y].pb(x);    	
    }
    cin >> k;
    vector<int> c(k+1);
    vector<vi> dis(k+1);
    vector<vi> vis(k+1);
    F(i, k){
    	cin >> c[i+1];
    	dijkstra(c[i+1],dis[i+1],vis[i+1]);
    }
    int dp[(1ll<<k)][k+1];
    for(int i=0;i<(1ll<<k);i++){
    	for(int j=0;j<=k;j++){
    		dp[i][j]=1e9;
    	}
    }
    for(int i=0;i<k;i++){
    	dp[(1ll<<i)][i+1]=1;
    }
    for(int i=0;i<(1ll<<k);i++){
    	for(int j=0;j<k;j++){
    		if((i&(1ll<<j))==0) continue;
    		int t = (i^(1ll<<j));
    		for(int l=0;l<k;l++){
    			if((t&(1ll<<l))==0) continue;
    			dp[i][j+1] = min(dp[i][j+1],dp[t][l+1] + dis[l+1][c[j+1]]);
    		}
    	}
    }
    for(int i=1;i<=k;i++){
    	ans = min(ans,dp[(1ll<<k)-1][i]);
    }    
    ans = (ans>=1e9) ? -1 : ans;
    
    cout << ans << '\n';
}
int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    // cin >> t;
    while (t--) solve();

    return 0;
}
#include<bits/stdc++.h>
#include<bits/extc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using namespace __gnu_pbds;
#ifdef DEBUG
#define debug(x) {{cerr<<#x<<": "; cerr<<x<<endl;}}
#define debugv(x) {{cerr<<#x<<": "; for(auto i:x) cerr<<i<<" "; cerr<<endl;}}
#else
#define debug(x)
#define debugv(x)
#define cerr while(0) cerr
#endif
#define int long long
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define priority_queue std::priority_queue
#define F first
#define S second

ll INF=1e15;
vi adj[100005], v;
bool vis[100005];
ll dp[150000][20], dist[20][100005];
void bfs(int src, int idx){
	memset(vis, false, sizeof vis);
	for(int i=0;i<100005;i++) dist[idx][i]=INF;
	dist[idx][src]=0;
	queue<int> q;
	q.push(src);
	vis[src]=true;
	while(!q.empty()){
		int x=q.front(); q.pop();
		for(int y:adj[x]){
			if(vis[y]) continue;
			q.push(y);
			vis[y]=true;
			assert(dist[idx][y]==INF);
			dist[idx][y]=dist[idx][x]+1;
		}
	}
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	memset(dp, -1, sizeof dp);
	int n, m;
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int x, y;
		cin>>x>>y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	int k;
	cin>>k;
	for(int i=0;i<k;i++) dp[1<<i][i]=1;
	for(int i=1;i<=k;i++){
		int x;
		cin>>x;
		v.push_back(x);
		bfs(x, i-1);
	}
	vi cur;
	for(int i=1;i<(1<<k);i++){
		cur.clear();
		if(dp[i][(int)(log2(i))]!=-1) continue;
		for(int j=0;j<k;j++){
			if(i&(1<<j)) cur.push_back(j);
		}
		cerr<<i<<" ";
		for(int j:cur){
			dp[i][j]=INF;
			for(int k:cur){
				if(j==k) continue;
				dp[i][j]=min(dp[i][j], dp[i^(1<<j)][k]+dist[j][v[k]]);
			}
			cerr<<dp[i][j]<<" ";
		}
		cerr<<endl;
	}
	ll ans=INF;
	for(int i=0;i<k;i++){
		ans=min(ans, dp[(1<<k)-1][i]);
	}
	if(ans>=INF){
		cout<<-1<<endl;
		return 0;
	}
	cout<<ans<<endl;
}