N,Q = map(int,input().split()) NS = str(N) for _ in range(Q): X = int(input()) XS = str(X) ok = 0 if len(XS) >= len(NS): XN = len(XS) NN = len(NS) for i in range(XN): if i+NN <= XN and XS[i:i+NN] == NS: ok = 1 if X % N == 0 or ok: print("Yes") else: print("No")