n,q,*x=[*map(int,open(0).read().split())] for i in x: if i%n==0 or str(n)in str(i): print('Yes') else: print('No')