#include <bits/stdc++.h>
using namespace std;

#ifdef Dhiraj
    #include "D:/dhiraj/Programming/debug.h"
#else
    #define d(...) 11
    #define cerr if(0) cerr
#endif

#define ll long long int
#define endl '\n'

template <typename T, typename U>
inline istream& operator >> (istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}
template <typename T>
inline istream& operator >> (istream& in, vector<T>& v) {
    for(T& x : v) in >> x;
    return in;
}

const ll INF = 1e10;
const ll N = 1e5 + 1;
const ll K = 17 + 1;

ll n, m, k;
vector<ll> g[N];
ll c[K];
ll dis[K][N];
ll dp[1ll << K][K];

void bfs(ll id)
{
    vector<bool> vis(n + 1, 0);
    vis[c[id]] = true;

    for(ll i = 0; i <= n; i++) {
        dis[id][i] = INF;
    }

    queue<ll> q;
    q.push(c[id]);

    dis[id][c[id]] = 0;
    while(!q.empty())
    {
        ll u = q.front();
        q.pop();

        for(ll v : g[u])
        {
            if(!vis[v])
            {
                vis[v] = true;
                dis[id][v] = dis[id][u] + 1;
                q.push(v);
            }
        }
    }
}

ll f(ll mask, ll u)
{
    if(mask == (1ll << (k + 1)) - 2) return 0;
    ll &ans = dp[mask][u];
    if(ans != -1) return ans;
    ans = INF;
    for(ll v = 1; v <= k; v++)
    {
        if((mask & (1ll << v)) == 0) {
            ans = min(ans, dis[u][c[v]] + f(mask | (1ll << v), v));
        }
    }
    return ans;
}

void solve(int &tc)
{
    cin >> n >> m;
    for(ll i = 0; i <= n; i++) {
        g[i].clear();
    }

    for(ll i = 0; i < m; i++)
    {
        ll x, y;
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }

    cin >> k;
    for(ll i = 1; i <= k; i++) {
        cin >> c[i];
        bfs(i);
    }
    
    memset(dp, -1, sizeof(dp));

    ll ans = INF;
    for(ll i = 1; i <= k; i++) {
        ans = min(ans, 1 + f(1ll << i, i));
    }
    if(ans == INF) ans = -1;
    cout << ans << endl;
}

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt", "r", stdin);
        freopen("D:/dhiraj/Programming/o1.txt", "w", stdout);
        freopen("D:/dhiraj/Programming/e1.txt", "w", stderr);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);

    int tc = 1;
    for(int i = 1; i <= tc; i++) {
        cerr << "Case #" << i << "\n";
        solve(i);
    }
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)
template<class T, class U> void umin(T& x, const U& y){ x = min(x, (T)y);}
template<class T, class U> void umax(T& x, const U& y){ x = max(x, (T)y);}
template<class T, class U> void init(vector<T> &v, U x, size_t n) { v=vector<T>(n, (T)x); }
template<class T, class U, typename... W> void init(vector<T> &v, U x, size_t n, W... m) { v=vector<T>(n);  for(auto& a : v) init(a, x, m...); }

int n, m, k;
vector<vector<int>> edges;
vector<int> c;
vector<int> vis;
vector<int> d;

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);
    cin >> n >> m;
    edges.resize(n+1);
    FOR(i, m){
        int u, v;
        cin >> u >> v;
        edges[u].push_back(v);
        edges[v].push_back(u);
    }
    cin >> k;
    c.resize(k);
    FOR(i, k) cin >> c[i];

    vector<vector<int>> dist(k, vector<int>(k));
    for (int i = 0; i < k; i++){
        vector<int> d(n+1, -1);
        d[c[i]] = 0;
        queue<int> Q;
        Q.push(c[i]);
        while (!Q.empty()){
            int v = Q.front();
            Q.pop();
            for (int w : edges[v]){
                if (d[w] == -1){
                    d[w] = d[v] + 1;
                    Q.push(w);
                }
            }
        }
        for (int j = 0; j < k; j++){
            dist[i][j] = d[c[j]];
        }
    }

    int K = 1<<k;
    const int inf = 1e9;
    vector<vector<int>> dp;
    init(dp, inf, K, k);
    FOR(i, k) dp[1<<i][i] = 0;
    FOR(mask, K){
        FOR(i, k){
            if ((mask & (1<<i))){
                int mask2 = mask ^ (1<<i);
                FOR(j, k){
                    if ((mask2 & (1<<j)) && dist[j][i] != -1){
                        umin(dp[mask][i], dp[mask2][j] + dist[j][i]);
                    }
                }
            }
        }
    }
    int sol = inf;
    FOR(i, k) umin(sol, dp[K-1][i]);
    cout << (sol < inf ? sol+1 : -1) << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

