N,M=map(int,input().split()) G=[[] for i in range(N)] for i in range(M): a,b=map(int,input().split()) G[a-1].append(b-1) G[b-1].append(a-1) K=int(input()) u=[False]*N if K>0: B=list(map(int,input().split())) for i in range(K): u[B[i]-1]=True dp=[[10**10]*5 for i in range(N)] dp[0][0]=0 from heapq import heappush,heappop S=[] heappush(S,0) kaku=[[False]*5 for i in range(N)] while S: w=heappop(S) cost=w//(10**6) w-=cost*10**6 pos=w//5 t=w%5 if kaku[pos][t]==True: continue kaku[pos][t]=True for y in G[pos]: t2=t if u[y]==True: t2+=1 else: t2=0 if t2<5: if dp[y][t2]>dp[pos][t]+1: dp[y][t2]=dp[pos][t]+1 heappush(S,(dp[y][t2])*10**6+y*5+t2) result=dp[N-1][0] if result>10**9: result=-1 print(result)