#include <bits/stdc++.h>
using namespace std;
const int N = 2e5;
int n, m, k;
int spe[N + 5];
vector<int> adj[N + 5];
int lvl[N + 5];
void bfs(int x, int *cnt) {
  queue<int> qx;
  qx.push(x);
  cnt[x] = 0;
  lvl[x] = 0;
  int ste = 0;
  while (!qx.empty()) {
    int pan = qx.size();
    ste++;
    for (int i = 0; i < pan; i++) {
      int nx = qx.front();
      qx.pop();
      for (int j = 0; j < adj[nx].size(); j++) {
        int cx = adj[nx][j];
        if (cnt[cx] != -1) continue;
        cnt[cx] = ste;
        qx.push(cx);
        lvl[cx] = ste;
      }
    }
  }
  return;
}
int cnt1[N + 5], cnt2[N + 5];
vector<pair<int, int> > kiri, kanan;
int main() {
  memset(cnt1, -1, sizeof(cnt1));
  memset(cnt2, -1, sizeof(cnt2));
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= k; i++) {
    scanf("%d", &spe[i]);
  }
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  bfs(1, cnt1);
  bfs(n, cnt2);
  for (int i = 1; i <= k; i++) {
    kiri.push_back(make_pair(lvl[spe[i]], spe[i]));
  }
  sort(kiri.begin(), kiri.end());
  reverse(kiri.begin(), kiri.end());
  int tmp = 0;
  priority_queue<pair<int, int> > pq, pend;
  for (int i = 1; i <= k; i++) {
    pq.push(make_pair(cnt2[spe[i]], spe[i]));
  }
  int idd = 0;
  int tm = 1;
  for (int i = 0; i < k; i++) {
    while (idd < k && kiri[idd].first > kiri[i].first) {
      pend.push(make_pair(cnt2[kiri[idd].second], kiri[idd].second));
      idd++;
    }
    while (!pend.empty() && pend.top() == pq.top()) {
      pq.pop();
      pend.pop();
    }
    if (!pq.empty()) {
      pair<int, int> cabut = make_pair(-1, -1);
      if (pq.top().second == kiri[i].second) {
        cabut = pq.top();
        pq.pop();
      }
      if (!pq.empty()) tm = max(tm, cnt1[kiri[i].second] + pq.top().first + 1);
      if (cabut.first != -1) pq.push(cabut);
    }
  }
  printf("%d\n", min(cnt1[n], tm));
  return 0;
}
