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