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