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")