#include <bits/stdc++.h>
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrepi(i,a,b) for(int i=((int)(b)-1);i>=(a);--i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) rrepi(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define ZERO(x) memset(x,0,sizeof(x))
#define MINUS(x) memset(x,-1,sizeof(x))
#define UNIQUE(x) (x).erase(unique(ALL(x)), (x).end())
#define TOUPPER(x) transform(ALL(x), (x).begin(), ::toupper)
#define TOLOWER(x) transform(ALL(x), (x).begin(), ::tolower)
#define debug(var)  do{std::cout << #var << " : "; view(var);}while(0)
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){for(const auto& v : vv){ view(v); } }
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void viewarr(T arr[], int n) { for(int i = 0; i < n; ++i) std::cout << arr[i] << " "; std::cout << std::endl; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll qp(ll a,ll b){ll ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
ll qp(ll a,ll b,ll mo){ll ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const int INF = 1e9;
const ll INFL = 1e18;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5;

struct Dijkstra {
    struct edge{
        int to, cost;
        edge(int to, int cost) : to(to), cost(cost) {}
    };

    int V;
    vector<vector<edge>> G;
    vector<ll> d;
    vector<int> prev;

    Dijkstra(int n) : V(n), G(n), d(n, INFL), prev(n, -1) {}

    void set(int from, int to, int cost) {
        G[from].push_back(edge(to, cost));
    }

    void calc(int s) {
        priority_queue<P, vector<P>, greater<P>> que;
        d[s] = 0;
        que.emplace(0, s);

        while(!que.empty()) {
            P p = que.top(); que.pop();
            int v = p.se;
            if(d[v] < p.fi) continue;
            for(edge e : G[v]) {
                if(d[e.to] > d[v] + e.cost) {
                    d[e.to] = d[v] + e.cost;
                    que.emplace(d[e.to], e.to);
                    prev[e.to] = v;
                }
            }
        }
    }

    ll dist(int to) {
        return d[to];
    }

    vector<int> get_path(int t) {
        vector<int> path;
        for(; t != -1; t = prev[t]) path.push_back(t);
        reverse(ALL(path));
        return path;
    }
};


int main() {
    int N, M; cin >> N >> M;
    vector<int> A(M), B(M);
    rep(i,M) cin >> A[i] >> B[i];
    int K; cin >> K;
    vector<int> C(K);
    rep(i,K) cin >> C[i];

    vector<vector<ll>> G(K, vector<ll>(K, INFL));
    rep(i,K) {
        Dijkstra d(N);
        rep(j,M) {
            d.set(A[j]-1, B[j]-1, 1);
            d.set(B[j]-1, A[j]-1, 1);
        }
        d.calc(C[i]-1);
        rep(j,K) G[i][j] = d.dist(C[j]-1);
    }

    vector<vector<ll>> dp(1 << K, vector<ll>(K, INFL));
    rep(i,K) dp[1<<i][i] = 0;
    for(int s = 0; s < 1 << K; s++) {
        for(int v = 0; v < K; v++) {
            for(int u = 0; u < K; u++) {
                if(s >> v & 1)chmin(dp[s][v], dp[s & ~(1<<v)][u] + G[u][v]);
            }
        }
    }

    ll ans = INFL;
    rep(i,K) chmin(ans, dp[(1 << K) -1][i] + 1);
    cout << (ans == INFL ? -1 : ans) << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
const int N = 100005;
const int K = 20;
int n, m, k, a[K], dis[K][N], dp[K][1 << K];
vector<int> adj[N];
void bfs(int idx)
{
    queue<int> q;
    q.push(a[idx]);
    for (int i = 1; i <= n; ++i)
        dis[idx][i] = -1;
    dis[idx][a[idx]] = 0;
    while (!q.empty())
    {
        int u = q.front();
        q.pop();
        for (int v: adj[u])
        {
            if (dis[idx][v] == -1)
            {
                dis[idx][v] = dis[idx][u] + 1;
                q.push(v);
            }
        }
    }
}
int solve(int last, int mask)
{
    if (mask == (1 << k) - 1)
        return dp[last][mask] = 0;
    if (dp[last][mask] != -1)
        return dp[last][mask];
    int cur = INT_MAX;
    for (int i = 0; i < k; ++i)
    {
        if (mask & (1 << i))
            continue;
        cur = min(cur, dis[last][a[i]] + solve(i, mask | (1 << i)));
    }
    return dp[last][mask] = cur;
}
int main(int argc, char const *argv[])
{
    cin >> n >> m;
    for (int i = 0; i < m; ++i)
    {
        int u, v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    cin >> k;
    for (int i = 0; i < k; ++i)
    {
        cin >> a[i];
        bfs(i);
    }
    for (int i = 0; i < k; ++i)
    {
        if (dis[0][a[i]] == -1)
            return cout << -1, 0;
    }
    int ans = INT_MAX;
    for (int i = 0; i < k; ++i)
    {
        memset(dp, -1, sizeof(dp));
        int cur = solve(i, (1 << i));
        ans = min(ans, 1 + cur);
        // cout << cur << '\n';
    }
    cout << ans << '\n';
    return 0;
}