# import bisect # Binary Search module for list # import sys # from sys import stdin, exit, setrecursionlimit # from collections import deque # from collections import Counter # from itertools import accumulate # from heapq import heappop, heappush # from atcoder.segtree import SegTree # from sortedcontainers import SortedSet, SortedList, SortedDict # input = stdin.readline def main(): N, Q = map(int, input().split()) strN = str(N) for _ in range(Q): x = int(input()) strx = str(x) if x%N==0: print("Yes") continue f = False for i in range(len(strx)-len(strN)+1): f1 = True for j in range(len(strN)): if strN[j]!=strx[i+j]: f1 = False break if f1: f = True break if f: print("Yes") else: print("No") # ===================================== # mylib # ===================================== def get_primenumbers(mx): """ エラトステネスの篩 引数mxまでの素数をリストで返す :param mx: 探索範囲の最大値 """ prime_l = [True for _ in range(mx+1)] prime_l[0] = False prime_l[1] = False for i in range(4, mx+1, 2): prime_l[i] = False i = 3 while i**2