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