#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 100;
namespace DarwinGame {
int d[2][N], special[N], f[N];
int n, m, k;
vector<int> e[N];
void Dijkstra(int k, int s) {
  for (int i = 1; i <= n; ++i) d[k][i] = -1;
  d[k][s] = 0;
  queue<int> q;
  q.push(s);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int v : e[u])
      if (d[k][v] == -1) {
        d[k][v] = d[k][u] + 1;
        q.push(v);
      }
  }
}
void Solve() {
  cin >> n >> m >> k;
  for (int i = 0; i < k; ++i) cin >> special[i];
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    e[u].push_back(v);
    e[v].push_back(u);
  }
  Dijkstra(0, 1);
  Dijkstra(1, n);
  sort(special, special + k, [](int a, int b) {
    return (d[0][a] != d[0][b] ? d[0][a] < d[0][b] : d[1][a] < d[1][b]);
  });
  f[k - 1] = d[1][special[k - 1]];
  for (int i = k - 2; i >= 0; --i) f[i] = max(d[1][special[i]], f[i + 1]);
  int ans = 0;
  for (int i = 0; i < k - 1; ++i) {
    ans = max(ans, min(d[0][n], 1 + d[0][special[i]] + f[i + 1]));
  }
  cout << ans << '\n';
}
}  // namespace DarwinGame
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int test = 1;
  while (test--) DarwinGame::Solve();
}
