#include <bits/stdc++.h>
const int maxn = 4e5 + 3;
int n, m, q, a[maxn];
bool ina[maxn];
std::vector<int> E[maxn];
void addedge() {
  int u, v;
  scanf("%d%d", &u, &v);
  E[u].push_back(v);
  E[v].push_back(u);
}
int d[maxn], t[maxn];
void bfs(int st, int *d) {
  static bool vis[maxn];
  memset(vis, 0, sizeof(vis));
  std::queue<int> q;
  q.push(st);
  d[st] = 0;
  vis[st] = true;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (auto &&v : E[u]) {
      if (vis[v]) continue;
      q.push(v);
      d[v] = d[u] + 1;
      vis[v] = true;
    }
  }
}
int tmax[maxn * 2], dmax[maxn * 2];
int solve() {
  for (int u = 1; u <= n; ++u)
    for (auto &&v : E[u])
      if (ina[u] && ina[v]) return d[n];
  memset(tmax, 0x80, sizeof(tmax));
  memset(dmax, 0x80, sizeof(dmax));
  int ans = std::min(d[a[0]] + t[a[1]] + 1, d[a[1]] + t[a[0]] + 1);
  for (int j = 0; j < q; ++j) {
    int u = a[j];
    int key = t[u] - d[u];
    int mtv = 0x80808080;
    for (int i = key + maxn; i > 0; i -= i & -i) {
      mtv = std::max(mtv, tmax[i]);
    }
    if (mtv >= 0) {
      ans = std::max(ans, d[u] + mtv + 1);
    }
    int mdv = 0x80808080;
    for (int i = key + maxn; i < maxn * 2; i += i & -i) {
      mdv = std::max(mdv, dmax[i]);
    }
    if (mdv >= 0) {
      ans = std::max(ans, t[u] + mdv + 1);
    }
    for (int i = key + maxn; i < maxn * 2; i += i & -i)
      tmax[i] = std::max(tmax[i], t[u]);
    for (int i = key + maxn; i > 0; i -= i & -i)
      dmax[i] = std::max(dmax[i], d[u]);
  }
  return ans;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < q; ++i) {
    scanf("%d", a + i);
    ina[a[i]] = true;
  }
  for (int i = 0; i < m; ++i) {
    addedge();
  }
  bfs(1, d);
  bfs(n, t);
  printf("%d\n", std::min(d[n], solve()));
  return 0;
}
