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 = 0 st = False while Q: while Q: x = Q.pop() if x == N - 1: st = False break 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: Q2.append(y) if st: break Q,Q2 = Q2,Q cnt += 1 if V[N-1] < 5: print(cnt - 1) else: print(-1)