#include<iostream>
#include<array>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
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;}

template <typename T>
struct Dijkstra{
    struct Edge{
        int to;
        T cost;
        Edge(int to,T cost):to(to),cost(cost){}
        bool operator<(const Edge &o)const{return cost>o.cost;}
    };
    const T inf = (numeric_limits<T>::max())/2;//infを設定する
    vector<vector<Edge>> G;
    vector<T> ds;
    vector<int> bs;
    Dijkstra(int n):G(n){}

    void add_edge(int u,int v,T c){
        G[u].push_back(Edge(v,c));
    }

    void build(int s){
        int n=G.size();
        ds.assign(n,inf);
        bs.assign(n,-1);

        priority_queue<Edge> pq;
        ds[s]=0;
        pq.emplace(s,ds[s]);

        while(!pq.empty()){
            auto p=pq.top();pq.pop();
            int v=p.to;
            if(ds[v]<p.cost) continue;
            for(auto e:G[v]){
                if(ds[e.to]>ds[v]+e.cost){
                    ds[e.to]=ds[v]+e.cost;
                    bs[e.to]=v;
                    pq.emplace(e.to,ds[e.to]);
                }
            }
        }
    }

    T operator[](int k){return ds[k];}

    vector<int> restore(int to){
        vector<int> res;
        if(bs[to]<0) return res;
        while(~to) res.emplace_back(to),to=bs[to];
        reverse(res.begin(),res.end());
        return res;
    }
};

int n,m,k;
int c[20];
int d[20][20];
int dp[200010][20];

void solve(){
    cin >> n >> m;
    Dijkstra<int> dij(n);
    rep(i,m){
        int a,b;cin >> a >> b;a--;b--;
        dij.add_edge(a,b,1);
        dij.add_edge(b,a,1);
    }
    cin >> k;
    rep(i,k) {
        cin >> c[i];c[i]--;
    }
    rep(i,k){
        dij.build(c[i]);
        rep(j,k){
            d[i][j]=dij[c[j]];
        }
    }
    int U=((1<<k)-1);
    rep(S,U+1){
        rep(i,k) dp[S][i]=mod;
    }
    rep(i,k) dp[(1<<i)][i]=1;
    rep(S,U+1){
        rep(i,k){
            rep(j,k){
                if(S&(1<<i)) if(S&(1<<j)){
                    chmin(dp[S][i],dp[S^(1<<i)][j]+d[j][i]);
                }
            }
        }
    }
    int ans=mod;
    rep(i,k) chmin(ans,dp[U][i]);
    if(ans<mod)cout << ans << endl;
    else cout << -1 << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2")
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define uniq(x) x.resize(unique(all(x)) - x.begin())
#define ff first
#define ss second
#define pb push_back
#define emb emplace_back
using namespace std;
using ull = unsigned long long;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int N = 1e5 + 5, K = 17;
int n, m, k, c[K], dist[K][N], dp[1 << K][K];
queue<int> q;
vector<int> adj[N];

void bfs(int s, int d[]) {
  for (int i = 1; i <= n; ++i) d[i] = -1;
  d[s] = 0; q.emplace(s);
  while (!q.empty()) {
    int u = q.front(); q.pop();
    for (int &v: adj[u]) {
      if (d[v] == -1) {
        d[v] = d[u] + 1;
        q.emplace(v);
      }
    }
  }
}

int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cin >> n >> m;
  for (int i = 1, a, b; i <= m; ++i) {
    cin >> a >> b;
    adj[a].emb(b);
    adj[b].emb(a);
  }
  cin >> k;
  for (int i = 0; i < k; ++i) {
    cin >> c[i];
    bfs(c[i], dist[i]);
  }
  for (int mk = 1; mk < (1 << k); ++mk) {
    if (__builtin_popcount(mk) == 1) {
      for (int i = 0; i < k; ++i) {
        if ((mk >> i) & 1) {
          dp[mk][i] = 1;
        } else {
          dp[mk][i] = -1;
        }
      }
    } else {
      for (int i = 0; i < k; ++i) {
        if ((mk >> i) & 1) {
          int omk = mk ^ (1 << i);
          dp[mk][i] = 1e9;
          for (int j = 0; j < k; ++j) {
            if (((omk >> j) & 1) && (dp[omk][j] != -1) && (dist[i][c[j]] != -1)) {
              dp[mk][i] = min(dp[mk][i], dp[omk][j] + dist[i][c[j]]);
            }
          }
          if (dp[mk][i] == 1e9) {
            dp[mk][i] = -1;
          }
        } else {
          dp[mk][i] = -1;
        }
      }
    }
  }
  int ans = 1e9;
  for (int i = 0; i < k; ++i) {
    if (dp[(1 << k) - 1][i] != -1) {
      ans = min(ans, dp[(1 << k) - 1][i]);
    }
  }
  if (ans == 1e9) {
    ans = -1;
  }
  cout << ans << "\n";
  return 0;
}