#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const int INF = 2000000000;
const long long LINF = 2000000000000000000;
template <typename T>
void print(vector<T>& a) {
  for (int i = 0; i < a.size(); i++) cout << a[i] << ' ';
  cout << '\n';
}
template <typename T>
void print(deque<T>& a) {
  for (int i = 0; i < a.size(); i++) cout << a[i] << ' ';
  cout << '\n';
}
template <typename T>
void print(vector<vector<T>>& a) {
  for (int i = 0; i < a.size(); i++) {
    for (int j = 0; j < a[i].size(); j++) cout << a[i][j] << ' ';
    cout << '\n';
  }
}
template <typename T>
void input(vector<T>& a) {
  for (int i = 0; i < a.size(); i++) cin >> a[i];
}
template <typename T>
void input(deque<T>& a) {
  for (int i = 0; i < a.size(); i++) cin >> a[i];
}
template <typename T>
void input(vector<vector<T>>& a) {
  for (int i = 0; i < a.size(); i++)
    for (int j = 0; j < a[i].size(); j++) cin >> a[i][j];
}
vector<vector<int>> g;
vector<int> spec;
vector<int> d0, dn;
int n, m, k;
vector<int> bfs(int st, int fn) {
  vector<int> d(n, INF);
  vector<int> used(n, false);
  d[st] = 0;
  used[st] = true;
  queue<int> q;
  q.push(st);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (auto to : g[v]) {
      if (!used[to]) {
        used[to] = true;
        d[to] = d[v] + 1;
        q.push(to);
      }
    }
  }
  return d;
}
bool cmp(int a, int b) { return d0[a] - dn[a] < d0[b] - dn[b]; }
void solve() {
  cin >> n >> m >> k;
  g = vector<vector<int>>(n);
  spec = vector<int>(k);
  for (int i = 0; i < k; i++) cin >> spec[i], spec[i]--;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  d0 = bfs(0, n - 1);
  dn = bfs(n - 1, 0);
  sort((spec).begin(), (spec).end(), cmp);
  vector<int> suff(k);
  suff[k - 1] = dn[spec[k - 1]];
  for (int i = k - 2; i >= 0; i--) suff[i] = max(dn[spec[i]], suff[i + 1]);
  int best = 0;
  for (int i = 0; i < k - 1; i++)
    best = max(best, d0[spec[i]] + 1 + suff[i + 1]);
  cout << min(best, dn[0]);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tst = 1;
  while (tst--) solve();
}
