N,M=map(int,input().split()) c=[0]*N for m in range(M): v,w=map(int,input().split()) c[v]+=1 c[w]+=1 S=set(map(int,input().split())) T=set() for n in range(N): if(c[n]>1):T.add(n) print(["No","Yes"][M>4or len(T)>2and S!=T])