a,b=map(int,input().split()) T=list(map(int,input().split())) S=list(map(int,input().split())) def euclid(a,b): r=a%b while r>0: a,b=b,r r=a%b return b gcdT=T[0] for t in T[1:]: gcdT=euclid(gcdT,t) ok=True for s in S: if s%gcdT!=0: ok=False break print('Yes' if ok else 'No')