#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return (b ? gcd(b, a % b) : a); }
long long lcm(long long a, long long b) {
  if (!a || !b) return 0;
  return a * b / gcd(a, b);
}
int popcount(long long x) { return __builtin_popcountll(x); }
long long poww(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a;
    a = a * a;
    b /= 2;
  }
  return res;
}
bool isPrime(long long x) {
  if (x == 1 or (x % 2 == 0 and x > 2)) return 0;
  for (long long i = 3; i * i <= x; i += 2)
    if (x % i == 0) return 0;
  return 1;
}
vector<int> sieve(int N) {
  vector<int> m(N + 1, 0);
  vector<int> primes(1, 2);
  for (int i = 4; i < N; i += 2) m[i] = 1;
  for (int i = 3; i * i <= N; i += 2)
    if (!m[i])
      for (int j = i * i; j < N; j += i) m[j] = 1;
  for (int i = 3; i < N; i += 2)
    if (!m[i]) primes.push_back(i);
  return primes;
}
int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
vector<vector<int>> graph(int n, int m, bool dir = 1) {
  vector<vector<int>> v(n + 1, vector<int>(0));
  for (int i = (0), ThxMK = (m); i < ThxMK; ++i) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    if (dir) v[b].push_back(a);
  }
  return v;
}
template <typename T>
static constexpr T inf = numeric_limits<T>::max() / 2;
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> e(k);
  for (int i = (0), ThxMK = (k); i < ThxMK; ++i) cin >> e[i];
  auto v = graph(n, m);
  vector<long long> disa(n + 1, inf<long long>), disb(n + 1, inf<long long>);
  auto bfs = [&](int second, vector<long long>& w) {
    queue<int> q;
    q.push(second);
    w[second] = 0;
    while (!q.empty()) {
      int a = q.front();
      q.pop();
      for (auto b : v[a])
        if (w[b] > w[a] + 1) {
          w[b] = w[a] + 1;
          q.push(b);
        }
    }
  };
  bfs(1, disa);
  bfs(n, disb);
  sort(begin(e), end(e),
       [&](int a, int b) { return disa[a] - disb[a] < disa[b] - disb[b]; });
  long long be = 0, mx = disa[e[0]];
  for (int i = (1), ThxMK = (k); i < ThxMK; ++i) {
    be = max(be, mx + disb[e[i]] + 1);
    mx = max(mx, disa[e[i]]);
  }
  cout << min(be, disa[n]) << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
