#include <bits/stdc++.h>
using namespace std;
const long long M = 1000000007;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n, m, k;
  cin >> n >> m >> k;
  vector<long long> A(k);
  vector<long long> os(n, false);
  for (long long i = 0; i < k; i++) {
    cin >> A[i];
    A[i]--;
    os[A[i]] = true;
  }
  vector<vector<long long>> graph(n);
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  vector<long long> depth1(n);
  vector<long long> depthn(n);
  deque<pair<long long, long long>> q = {{0, 0}};
  vector<long long> used(n, false);
  used[0] = true;
  depth1[0] = 0;
  while (!q.empty()) {
    pair<long long, long long> v = q.front();
    q.pop_front();
    for (auto u : graph[v.first]) {
      if (!used[u]) {
        used[u] = true;
        q.push_back({u, v.second + 1});
        depth1[u] = v.second + 1;
      }
    }
  }
  q = {{n - 1, 0}};
  fill(used.begin(), used.end(), false);
  used[n - 1] = true;
  depthn[n - 1] = 0;
  while (!q.empty()) {
    pair<long long, long long> v = q.front();
    q.pop_front();
    for (auto u : graph[v.first]) {
      if (!used[u]) {
        used[u] = true;
        q.push_back({u, v.second + 1});
        depthn[u] = v.second + 1;
      }
    }
  }
  long long ans = depth1[n - 1];
  vector<long long> D1(k), D2(k);
  for (long long i = 0; i < k; i++) {
    D1[i] = depth1[A[i]];
    D2[i] = depthn[A[i]];
  }
  vector<pair<long long, long long>> D3;
  for (long long i = 0; i < k; i++) {
    D3.push_back({D1[i] - D2[i], i});
  }
  sort(D3.begin(), D3.end());
  vector<long long> sufmax(k + 1);
  for (long long i = k - 1; i >= 0; i--) {
    sufmax[i] = max(sufmax[i + 1], D2[D3[i].second]);
  }
  long long balik = 0;
  for (long long i = 0; i < k - 1; i++) {
    long long kek = 1 + D1[D3[i].second] + sufmax[i + 1];
    balik = max(balik, kek);
  }
  ans = min(ans, balik);
  cout << ans;
}
