#pragma GCC optimize("-Ofast","-funroll-all-loops")
#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#include <bits/stdc++.h>
using namespace std;
//#define int long long
//#define ULL unsigned long long
#define fi first
#define se second
#define ls 2 * rt
#define rs 2 * rt + 1
#define PII pair<int,int>
#define PDD pair<double, double>
#define gcd(a,b) __gcd(a,b)
#define lowbit(x) (x & (-x))
typedef long long ll;
const int N = 1e5 + 5;
const int M = 2e5 + 5;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
// const ll mod = 1e9 + 7;
// const ll inf = 0x3f3f3f3f3f3f3f3f;

int n, m;
int k;
int dist[20][100010];
int c[20];
int dp[18][1 << 18];
int vis[100010];
vector<int> path[100010];

void bfs(int u){
    for(int i = 1; i <= n; i++){
        dist[u][i] = inf;
    }
    memset(vis, 0, sizeof vis);
    dist[u][c[u]] = 0;
    queue<int> q;
    q.push(c[u]);
    vis[c[u]] = 1;
    while(!q.empty()){
        int f = q.front();
        q.pop();
        for(auto v : path[f]){
            if(!vis[v]){
                vis[v] = 1;
                dist[u][v] = dist[u][f] + 1;
                q.push(v);
            }
        }
    }

}

int solve(int i, int zt){
    if(zt == (1 << k) - 1){
        return 0;
    }
    if(dp[i][zt] != -1){
        return dp[i][zt];
    }
    int res = inf;
    for(int j = 0; j < k; j++){
        if(((1 << j)&zt)){
            continue;
        }
        res = min(res, solve(j, zt | (1 << j)) + dist[j][c[i]] );
    }
    return dp[i][zt] = res;
}


void solve(){
    cin >> n >> m;
    for(int i = 1; i <= m; i++){
        int a, b;
        cin >> a >> b;
        path[a].push_back(b);
        path[b].push_back(a);
    }
    cin >> k;
    for(int i = 0; i < k; i++){
        cin >> c[i];
        bfs(i);
    }
    int ok = 1;
    for(int i = 0; i < k; i++){
        if(dist[i][c[0]] >= inf){
            ok = 0;
            break;
        }
    }
    if(!ok){
        cout << "-1" << "\n";
        return ;
    }
    memset(dp, -1, sizeof dp);
    int ans = inf;
    for(int i = 0; i < k; i++){
        ans = min(ans, 1 + solve(i, 1 << i));
    }
    cout << ans << "\n";
    return ;
}

int main(){
    solve();

#ifndef ONLINE_JUDGE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

#define REP(i,a,b) for(int i=a;i<=b;i++)
using LL = long long;

const int Nmax=1e5+9,INF=987'654'321;
int N,M,a,b,dist[19][19],K,C[19],D[Nmax],Nt;
int visited[Nmax],q,dp[19][(1<<19)],ans=INF;
vector <int> adj[Nmax];

int F(int s, int e) {
    fill(D+1,D+N+1,INF);
    fill(visited+1,visited+N+1,0);
    queue <int> Q;
    D[s]=0;     visited[s]=1;   Q.push(s);
    while (!Q.empty()) {
        q=Q.front();    Q.pop();
        for (auto u : adj[q]) {
            if (visited[u]) continue;
            D[u]=D[q]+1;    visited[u]=1;   Q.push(u);
        }
    }
    return D[e];
}

int DFS(int place, int visited) {
    if (dp[place][visited]<INF) return dp[place][visited];
    if (visited==(1<<K)-1) return 0;
    REP(k,1,K) {
        if (((visited>>(k-1))&1)==0)
            dp[place][visited]=min(dp[place][visited],dist[place][k]+DFS(k,visited|(1<<(k-1))));
    }
    // cout<<place<<" "<<visited<<" "<<dp[place][visited]<<"\n";
    return dp[place][visited];
}

int main() {
    ios_base::sync_with_stdio(0);    cin.tie(0);
    cin>>N>>M;
    REP(j,1,M) {
        cin>>a>>b;
        adj[a].push_back(b);        adj[b].push_back(a);
    }
    cin>>K;     Nt=(1<<K)-1;
    REP(k,1,K) cin>>C[k];
    REP(i,1,K-1) {
        REP(j,i+1,K) {
            dist[i][j]=dist[j][i]=F(C[i],C[j]);
            if (dist[i][j]==INF) ans=-1;
            // cout<<i<<" "<<j<<" "<<dist[i][j]<<endl;
        }
    }
    if (ans==-1) cout<<-1;
    else {
        REP(i,1,K) {
            REP(j,0,Nt) dp[i][j]=INF;
        }
        REP(i,1,K) {
            ans=min(ans,1+DFS(i,1<<(i-1)));
        }
        cout<<ans;
    }
    return 0;
}
