from heapq import heappop, heappush def main(): C = 5 N, M = map(int, input().split()) G = [[] for _ in range(N * C)] UV = [] for _ in range(M): u, v = map(int, input().split()) UV.append((u - 1, v - 1)) K = int(input()) if K: A = list(map(lambda x: int(x) - 1, input().split())) A = set(A) else: A = set() for u, v in UV: if v in A: for c in range(C - 1): G[u * C + c].append(v * C + c + 1) else: for c in range(C): G[u * C + c].append(v * C) if u in A: for c in range(C - 1): G[v * C + c].append(u * C + c + 1) else: for c in range(C): G[v * C + c].append(u * C) INF = 10**18 dp = [INF] * (N * C) dp[0] = 0 q = [(0, 0)] while q: cnt, node = heappop(q) if cnt > dp[node]: continue for to in G[node]: if cnt + 1 < dp[to]: dp[to] = cnt + 1 heappush(q, (cnt + 1, to)) ans = INF for c in range(C): ans = min(ans, dp[(N - 1) * C + c]) if ans < INF: print(ans) else: print(-1) return main()