from math import* (a,b),t,s=[[*map(int,s.split())]for s in open(0)] g=t[0] for i in t: g=gcd(g,i) for i in s: if i%g: exit(print('No')) print('Yes')