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