#include <bits/stdc++.h>
#pragma GCC optimize("2")
using namespace std;
const long long mxn = 5e5 + 5;
const long long mxm = 5e5 + 5;
const long long INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
const double eps = 1e-7;
const double pii = 3.1415926535898;
long long gcd(long long x, long long y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
long long qpow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return ans;
}
long long lowbit(long long x) { return (x & (-x)); }
long long qmul(long long a, long long b) {
  long long ans = 0;
  while (b) {
    if (b & 1) ans = (ans + a) % mod;
    b >>= 1;
    a = (a + a) % mod;
  }
  return ans;
}
struct Edge {
  long long to, next, val;
};
Edge e[mxn << 1];
long long head[mxn];
long long cnt_qxx = 1;
void addedge(long long u, long long v, long long w) {
  e[++cnt_qxx].to = v;
  e[cnt_qxx].val = w;
  e[cnt_qxx].next = head[u];
  head[u] = cnt_qxx;
}
long long n, m, k;
long long a[mxn];
long long dis1[mxn], disn[mxn];
queue<long long> q;
long long mx[mxn], id[mxn];
void bfs(long long u, long long d[]) {
  while (!q.empty()) q.pop();
  q.push(u);
  d[u] = 0;
  while (!q.empty()) {
    long long v = q.front();
    q.pop();
    for (long long i = head[v]; i != -1; i = e[i].next) {
      long long vv = e[i].to;
      if (vv == u || d[vv]) continue;
      d[vv] = d[v] + 1;
      q.push(vv);
    }
  }
}
struct node {
  long long d1, dn, a;
  bool operator<(const node &b) const { return d1 - dn < b.d1 - b.dn; }
} vet[mxn];
bool cmp(long long a, long long b) {
  return dis1[a] - disn[a] < dis1[b] - disn[b];
}
signed main(void) {
  memset(head, -1, sizeof(head));
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (long long i = 1; i <= k; i++) {
    cin >> a[i];
    id[i] = i;
  }
  for (long long i = 1; i <= m; i++) {
    long long u, v;
    cin >> u >> v;
    addedge(u, v, 1);
    addedge(v, u, 1);
  }
  bfs(1, dis1);
  bfs(n, disn);
  for (long long i = 1; i <= k; i++) {
    vet[i].d1 = dis1[a[i]];
    vet[i].dn = disn[a[i]];
    vet[i].a = a[i];
  }
  sort(vet + 1, vet + k + 1);
  long long res = 0, mx = 0;
  for (long long i = 1; i < k; i++) {
    mx = max(mx, vet[i].d1);
    res = max(res, vet[i + 1].dn + mx + 1);
  }
  cout << min(res, disn[1]) << endl;
}
