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