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