#include <bits/stdc++.h>   using namespace std;   template <typename Arg1>   void __f(const char* name, Arg1&& arg1) {     cout << name <<   :   << arg1 <<   n ;   }   template <typename Arg1, typename... Args>   void __f(const char* names, Arg1&& arg1, Args&&... args) {     const char* comma = strchr(names + 1,  , );     cout.write(names, comma - names) <<   :   << arg1 <<   ,  ;     __f(comma + 1, args...);   }   const int N = 2e5 + 10;   const int INF = 1e8;   int n;   vector<int> g[N];   vector<int> BFS(vector<int> v, int src) {     vector<int> dist = vector<int>(n, INF);     queue<int> q;     q.push(src);     dist[src] = 0;     while (!q.empty()) {       int u = q.front();       q.pop();       for (auto v : g[u])         if (dist[v] == INF) {           dist[v] = dist[u] + 1;           q.push(v);         }     }     return dist;   }   int main() {     ios::sync_with_stdio(0);     int i, j, k, m;     cin >> n >> m >> k;     vector<int> a(k);     for (i = 0; i < k; ++i) {       cin >> a[i];       a[i]--;     }     for (i = 0; i < m; ++i) {       int u, v;       cin >> u >> v;       u--, v--;       g[u].push_back(v);       g[v].push_back(u);     }     vector<int> d1 = BFS(a, 0);     vector<int> d2 = BFS(a, n - 1);     vector<int> b = {0};     vector<int> D3 = BFS(b, n - 1);     int d3 = D3[0];     sort(a.begin(), a.end(),          [&](int x, int y) { return d1[x] - d2[x] < d1[y] - d2[y]; });     vector<int> suf(k);     suf[k - 1] = d2[a[k - 1]];     for (i = k - 2; i >= 0; --i) suf[i] = max(suf[i + 1], d2[a[i]]);     int mx = 0;     for (i = 0; i < k - 1; ++i) mx = max(d1[a[i]] + suf[i + 1] + 1, mx);     cout << min(d3, mx) <<   n ;     return 0;   }   