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