#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int inf = 2000000000;
const long long infLL = 9000000000000000000;
template <typename first, typename second>
ostream &operator<<(ostream &os, const pair<first, second> &p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &v) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ",";
    os << *it;
  }
  return os << "]";
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &v) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}
template <typename first, typename second>
ostream &operator<<(ostream &os, const map<first, second> &v) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ", ";
    os << it->first << " = " << it->second;
  }
  return os << "]";
}
void faltu() { cerr << '\n'; }
template <typename T>
void faltu(T a[], int n) {
  for (int i = 0; i < n; ++i) cerr << a[i] << ' ';
  cerr << '\n';
}
template <typename T, typename... hello>
void faltu(T arg, const hello &...rest) {
  cerr << arg << ' ';
  faltu(rest...);
}
const int mx = 2e5 + 5;
int n, m, k;
int a[mx];
vector<int> adjlist[mx];
int lvl[2][mx];
void bfs(int source, int id) {
  queue<int> q;
  lvl[id][source] = 0;
  q.push(source);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (auto v : adjlist[u]) {
      if (lvl[id][v] == -1) {
        lvl[id][v] = lvl[id][u] + 1;
        q.push(v);
      }
    }
  }
}
bool cmp(const int &x, const int &y) {
  return lvl[0][x] - lvl[1][x] < lvl[0][y] - lvl[1][y];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  memset(lvl, -1, sizeof(lvl));
  cin >> n >> m >> k;
  for (int i = 0; i < k; ++i) cin >> a[i];
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    adjlist[x].push_back(y);
    adjlist[y].push_back(x);
  }
  bfs(1, 0);
  bfs(n, 1);
  sort(a, a + k, cmp);
  int m = lvl[0][a[0]], ans = lvl[0][n];
  int best = 0;
  for (int i = 1; i < k; ++i) {
    best = max(best, m + lvl[1][a[i]] + 1);
    m = max(m, lvl[0][a[i]]);
  }
  ans = min(ans, best);
  cout << ans << '\n';
}
