#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, m, k, a[N], l[N], r[N], vis[N], pre[N];
vector<int> G[N];
vector<pair<int, int> > vec;
void bfs1() {
  for (int i = 1; i <= n; i++) vis[i] = 0;
  queue<int> q;
  q.push(1);
  vis[1] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (auto v : G[u]) {
      if (vis[v]) continue;
      l[v] = l[u] + 1;
      q.push(v);
      vis[v] = 1;
    }
  }
}
void bfs2() {
  for (int i = 1; i <= n; i++) vis[i] = 0;
  queue<int> q;
  q.push(n);
  vis[n] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (auto v : G[u]) {
      if (vis[v]) continue;
      r[v] = r[u] + 1;
      q.push(v);
      vis[v] = 1;
    }
  }
}
bool cmp(pair<int, int> a, pair<int, int> b) { return a.first < b.first; }
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= k; i++) {
    int x;
    scanf("%d", &x);
    a[i] = x;
  }
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  bfs1();
  bfs2();
  for (int i = 1; i <= k; i++) {
    vec.push_back({l[a[i]] - r[a[i]], a[i]});
  }
  sort(vec.begin(), vec.end(), cmp);
  pre[0] = vec[0].second;
  for (int i = 1; i < k; i++) {
    int u = vec[i].second;
    if (l[u] > l[pre[i - 1]])
      pre[i] = u;
    else
      pre[i] = pre[i - 1];
  }
  int mx = -1;
  for (int i = 1; i < k; i++) {
    int u = vec[i].second;
    int now = r[u] + l[pre[i - 1]] + 1;
    mx = max(mx, now);
  }
  int ans = min(l[n], mx);
  printf("%d\n", ans);
}
