#include <bits/stdc++.h>
using namespace std;
long long Min(long long a, long long b) { return (a < b) ? a : b; }
long long Max(long long a, long long b) { return (a < b) ? b : a; }
long long gcd(long long m, long long n) {
  if (n == 0) return m;
  return gcd(n, m % n);
}
long long lcm(long long m, long long n) { return m * n / gcd(m, n); }
vector<long long> v[500005], nodes;
long long dist[500005], visited1[500005], visited2[500005], dist_e[500005];
long long cmp(long long x, long long y) { return dist[x] < dist[y]; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < k; i++) {
    long long t;
    cin >> t;
    nodes.push_back(t);
  }
  for (int i = 0; i < m; i++) {
    long long s, e;
    cin >> s >> e;
    v[s].push_back(e);
    v[e].push_back(s);
  }
  queue<int> q;
  q.push(1);
  visited1[1] = 1;
  while (!q.empty()) {
    long long x = q.front();
    q.pop();
    for (auto t : v[x]) {
      if (!visited1[t]) {
        visited1[t] = 1;
        dist[t] = dist[x] + 1;
        q.push(t);
      }
    }
  }
  q.push(n);
  visited2[n] = 1;
  while (!q.empty()) {
    long long x = q.front();
    q.pop();
    for (auto t : v[x]) {
      if (!visited2[t]) {
        visited2[t] = 1;
        dist_e[t] = dist_e[x] + 1;
        q.push(t);
      }
    }
  }
  sort((nodes).begin(), (nodes).end(), cmp);
  long long ans = 0;
  long long diff = 1e18;
  for (int i = 1; i < k; i++) {
    long long fr = nodes[i - 1], bc = nodes[i];
    ans = Max(ans, min({dist[n], dist[fr] + dist_e[bc] + 1,
                        dist[bc] + dist_e[fr] + 1}));
  }
  cout << ans;
  exit(0);
}
