#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }


int V, E;
const int MAX_V = 2e5 + 5;
using DD = int; //ll;
#define INF 1e9+7
DD d[MAX_V];
struct edge {int to; DD cost; };
vector<edge> G[MAX_V];

int pprev[MAX_V];

void add_edge(int from, int to, DD dist) {
    G[from].push_back((edge){to, dist}); 
    G[to].push_back((edge){from, dist}); 
}
void dijkstra(int s){
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d + V, INF);
    fill(pprev, pprev + V, -1);
    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 (int i = 0; i < G[v].size(); i++){
            edge e = G[v][i];
            if (d[e.to] >  d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
                pprev[e.to] = v;
            }
        }
    }
}


const int MAX_N = 17;


//int n;
int dd[MAX_N][MAX_N];
int dp[1 << MAX_N][MAX_N];
int N, M, K;


int rec(int S, int v, int dep){
    if (dp[S][v] >= 0) {
        return dp[S][v];
    }
    if (S == (1 << K) - 1){
        return dp[S][v] = 0;
    }
    int res = INF;
    for (int u = 0; u < K; u++) {
        if (!(S >> u & 1)) {
            res = min(res, rec(S | 1 << u, u, dep + 1) + dd[v][u]);
        }
    }
    return dp[S][v] = res;
}
int C[100005];
int main() {
    cin >> N >> M;
    V = N, E = M;
    rep(i, M){
        int a, b;
        cin >> a >> b;
        a--; b--;
        add_edge(a, b, 1);
    }
    cin >> K;
    rep(i, K){
        cin >> C[i];
        C[i]--;
    }
    
    rep(i, K)rep(j, K){
        dd[i][j] = INF;
        if (i > j){
            
            
            
            int s = C[i], g = C[j];
    
            dijkstra(s); 
            dd[i][j] = d[g];
            dd[j][i] = d[g];
            //fprintf(stderr, "dd[%d][%d] = %d\n", C[i] + 1, C[j] + 1, dd[i][j]);
            if (d[g] == INF){
                cout << -1;
                return 0;
            }
                
        }
    }
    
    memset(dp, -1, sizeof(dp));
    int res = INF;
    for (int u = 0; u < K; u++) {
         chmin(res, rec(1 << u, u, 1));
    }
    cout << res + 1;
}

#include <bits/stdc++.h>

using namespace std ;

const int MAX = 18 ;

int mark[MAX][MAX] ;
int n , m ;
int can[1 << MAX] , dp[1 << MAX] ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n>>m ;
	for(int i = 0 ; i < m ; ++i)
	{
		int a , b ;
		cin>>a>>b ;
		a-- , b-- ;
		mark[a][b] = mark[b][a] = 1 ;
	}
	can[0] = 1 ;
	for(int mask = 1 ; mask < (1 << n) ; ++mask)
	{
		int first = -1 ;
		for(int bit = 0 ; bit < n ; ++bit)
		{
			if((mask & (1 << bit)))
			{
				if(first == -1)
					can[mask] = can[mask ^ (1 << bit)] , first = bit ;
				else
					can[mask] &= mark[first][bit] ;
			}
		}
	}
	dp[0] = 0 ;
	for(int mask = 1 ; mask < (1 << n) ; ++mask)
	{
		dp[mask] = 1e9 ;
		for(int submask = mask ; submask ; submask = (submask - 1) & mask)
		{
			if(can[submask])
				dp[mask] = min(dp[mask] , 1 + dp[mask ^ submask]) ;
		}
	}
	return cout<<dp[(1 << n)-1]<<"\n" , 0 ;
}		