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