import std; void main () { int N, Q; readln.read(N, Q); auto X = new int[](Q); foreach (i; 0 .. Q) { X[i] = readln.chomp.to!int; } string n = N.to!string; auto ans = new bool[](Q); foreach (i; 0 .. Q) { if (X[i] % N == 0) { ans[i] = true; } string x = X[i].to!string; foreach (j; 0 .. x.length) { if (j + n.length <= x.length && x[j .. j + n.length] == n) { ans[i] = true; } } } foreach (i; 0 .. Q) { writeln(ans[i] ? "Yes" : "No"); } } void read (T...) (string S, ref T args) { import std.conv : to; import std.array : split; auto buf = S.split; foreach (i, ref arg; args) { arg = buf[i].to!(typeof(arg)); } }