#include <bits/stdc++.h>
using namespace std;
using cd = complex<double>;
const long long Inf = 100000000;
const long long mod = 1e9 + 7;
const double Pi = acos(-1);
void Fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
long long n, m, k;
long long a[200005], Dist[200005], Dist2[200005];
vector<long long> Adj[200005];
bool Compare(long long a, long long b) {
  return Dist[a] - Dist2[a] < Dist[b] - Dist2[b];
}
signed main() {
  Fastio();
  cin >> n >> m >> k;
  {
    for (long long i = 1; i <= k; i++) {
      cin >> a[i];
    }
  }
  for (long long i = 1; i <= m; i++) {
    long long u, v;
    cin >> u >> v;
    Adj[u].emplace_back(v);
    Adj[v].emplace_back(u);
  }
  for (long long i = 1; i <= n; i++) {
    Dist[i] = 1e9;
  }
  Dist[1] = 0;
  queue<long long> BFS;
  BFS.push(1);
  while (BFS.empty() == false) {
    long long node = BFS.front();
    BFS.pop();
    for (auto x : Adj[node]) {
      if (Dist[x] > Dist[node] + 1) {
        Dist[x] = Dist[node] + 1;
        BFS.push(x);
      }
    }
  }
  BFS.push(n);
  for (long long i = 1; i <= n; i++) {
    Dist2[i] = 1e9;
  }
  Dist2[n] = 0;
  while (BFS.empty() == false) {
    long long node = BFS.front();
    BFS.pop();
    for (auto x : Adj[node]) {
      if (Dist2[x] > Dist2[node] + 1) {
        Dist2[x] = Dist2[node] + 1;
        BFS.push(x);
      }
    }
  }
  sort(a + 1, a + k + 1, Compare);
  long long ans = 0, e = Dist[a[1]];
  for (long long i = 2; i <= k; i++) {
    ans = max(ans, e + Dist2[a[i]] + 1);
    e = max(e, Dist[a[i]]);
  }
  cout << min(ans, Dist[n]);
}
