#include <bits/stdc++.h>
using namespace std;
const long long INF(0x3f3f3f3f3f3f3f3fll);
const long long N = 2e5 + 10;
long long n, m, k;
long long dist1[N], dist2[N];
priority_queue<pair<long long, long long>, vector<pair<long long, long long> >,
               greater<pair<long long, long long> > >
    que, q2;
long long num, head[N], vis[N], cnt, ans;
struct node {
  long long x, pos;
  bool operator<(const node &s) const {
    if (x != s.x)
      return x < s.x;
    else
      return pos < s.pos;
  }
} a[N];
bool cmp(node a, node b) {
  if (a.x != b.x) return a.x < b.x;
  return a.pos < b.pos;
}
struct Edge {
  long long v, nex;
} edge[N << 1];
void add_edge(long long u, long long v) {
  edge[num].v = v;
  edge[num].nex = head[u];
  head[u] = num++;
}
void dij1(long long s) {
  for (long long i = 1; i <= n; i++) dist1[i] = dist2[i] = INF;
  dist1[s] = 0;
  que.push(make_pair(0, s));
  while (!que.empty()) {
    pair<long long, long long> p = que.top();
    que.pop();
    long long u = p.second;
    if (p.first != dist1[u]) continue;
    for (long long i = head[u]; i != -1; i = edge[i].nex) {
      long long v = edge[i].v, w = 1;
      if (dist1[v] > dist1[u] + w) {
        dist1[v] = dist1[u] + w;
        que.push(make_pair(dist1[v], v));
      }
    }
  }
}
void dij2(long long s) {
  dist2[s] = 0;
  q2.push(make_pair(0, s));
  while (!q2.empty()) {
    pair<long long, long long> p = q2.top();
    q2.pop();
    long long u = p.second;
    if (p.first != dist2[u]) continue;
    for (long long i = head[u]; i != -1; i = edge[i].nex) {
      long long v = edge[i].v, w = 1;
      if (dist2[v] > dist2[u] + w) {
        dist2[v] = dist2[u] + w;
        q2.push(make_pair(dist2[v], v));
      }
    }
  }
}
void init() {
  memset(head, -1, sizeof(head));
  num = 0;
}
signed main() {
  cin >> n >> m >> k;
  init();
  for (long long i = 1; i <= k; i++) {
    long long x;
    cin >> x;
    vis[x] = 1;
  }
  for (long long i = 1; i <= m; i++) {
    long long u, v;
    cin >> u >> v;
    add_edge(u, v);
    add_edge(v, u);
  }
  dij1(1);
  dij2(n);
  for (long long i = 1; i <= n; i++) {
    if (!vis[i]) continue;
    a[++cnt].pos = i, a[cnt].x = dist1[i];
  }
  sort(a + 1, a + cnt + 1);
  for (long long i = 1; i <= cnt - 1; i++) {
    long long vv = min(dist1[n], dist1[a[i].pos] + 1 + dist2[a[i + 1].pos]);
    vv = min(vv, dist1[a[i + 1].pos] + 1 + dist2[a[i].pos]);
    ans = max(ans, vv);
  }
  cnt = 0;
  for (long long i = 1; i <= n; i++) {
    if (!vis[i]) continue;
    a[++cnt].pos = i, a[cnt].x = dist2[i];
  }
  sort(a + 1, a + cnt + 1);
  for (long long i = 1; i <= cnt - 1; i++) {
    long long vv = min(dist1[n], dist1[a[i].pos] + 1 + dist2[a[i + 1].pos]);
    vv = min(vv, dist1[a[i + 1].pos] + 1 + dist2[a[i].pos]);
    ans = max(ans, vv);
  }
  cout << ans << '\n';
  return 0;
}
