N, Q = map(int,input().split()) for _ in range(Q): X = input() if int(X)%N==0 or str(N) in X: print("Yes") else: print("No")