#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2, typename T3>
class triple {
 public:
  T1 first;
  T2 second;
  T3 third;
  triple() {
    first = 0;
    second = 0;
    third = 0;
  }
};
const int maxn = 2e5 + 10;
int n, m, k, tmp, ans;
int dp[maxn], dp1[maxn], a[maxn];
vector<int>(g)[(maxn)];
bool sortfunc(int x, int y) { return dp[x] - dp1[x] < dp[y] - dp1[y]; }
void bfs(int x, int *h) {
  queue<int> Q;
  Q.push(x);
  for (int(i) = (1); (i) < (n + 1); (i)++) h[i] = -1;
  h[x] = 0;
  while (!Q.empty()) {
    int v = Q.front();
    Q.pop();
    for (int i : g[v])
      if (h[i] == -1) {
        h[i] = h[v] + 1;
        Q.push(i);
      }
  }
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m >> k;
  for (int((i)) = (0); ((i)) < ((k)); ((i))++) cin >> a[i];
  for (int((i)) = (0); ((i)) < ((m)); ((i))++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  bfs(1, dp);
  bfs(n, dp1);
  sort(a, a + k, sortfunc);
  tmp = dp[a[0]];
  for (int(i) = (1); (i) < (k); (i)++) {
    ans = max(ans, 1 + tmp + dp1[a[i]]);
    tmp = max(tmp, dp[a[i]]);
  }
  cout << min(ans, dp[n]) << '\n';
  return 0;
}
