#include constexpr int N = 15; int main() { std::cin.tie(nullptr)->sync_with_stdio(false); int n, m, k; std::cin >> n >> m >> k; std::vector a(k); for (auto &x : a) std::cin >> x, --x; std::vector> g(n); for (int i = 0; i < m; ++i) { int u, v; std::cin >> u >> v, --u, --v; g[u].push_back(v); g[v].push_back(u); } int dp[N][1 << N][N]{}; for (int i = 0; i < k; ++i) dp[i][1 << a[i]][a[i]] = 1; for (int i = 0; i < k; ++i) for (unsigned mask = 0; mask < (1u << n); ++mask) for (int j = 0; j < n; ++j) if (dp[i][mask][j]) for (auto &nj : g[j]) if (~mask >> nj & 1) dp[i][mask | 1 << nj][nj] = 1; int turn[N + 1][N]{}; for (int i = 0; i < k; ++i) for (unsigned mask = 0; mask < (1u << n); ++mask) for (int j = 0; j < n; ++j) if (dp[i][mask][j]) turn[__builtin_popcount(mask)][j] |= 1 << i; int res = 0; for (int step = 0; step <= n; ++step) for (int i = 0; i < n; ++i) if (turn[step][i] == (1 << k) - 1) { std::cout << i + 1 << '\n'; return 0; } std::cout << -1 << '\n'; return 0; }