N,M = map(int,input().split()) UV = [list(map(int,input().split())) for _ in range(M)] K = int(input()) if K: A = set([i-1 for i in list(map(int,input().split()))]) else: A = [] E = [[] for _ in range(N)] for u, v in UV: u -= 1 v -= 1 E[u].append(v) E[v].append(u) V = [5] * N V[0] = 0 Q = [0] Q2 = [] cnt = 1 st = False while Q: while Q: x = Q.pop() for y in E[x]: if y in A: tmp = V[x] + 1 else: tmp = 0 if V[y] > tmp: V[y] = tmp if V[y] < 5: if y == N - 1: print(cnt) exit() Q2.append(y) cnt += 1 Q,Q2 = Q2,Q print(-1)