from math import gcd a, b = map(int, input().split()) T = list(map(int, input().split())) S = list(map(int, input().split())) gt = 0 for t in T: gt = gcd(gt, t) gs = 0 for s in S: gs = gcd(gs, s) if gs % gt == 0: print("Yes") else: print("No")