N, Q = map(int, input().split()) sN = str(N) for _ in range(Q): X = input() if int(X) % N == 0 or X.find(sN) != -1: print('Yes') else: print('No')