#include using namespace std; using ll = long long; bool chmax(auto &a, auto b) { return a < b ? a = b, 1 : 0; } bool chmin(auto &a, auto b) { return a > b ? a = b, 1 : 0; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N, Q; cin >> N >> Q; string S = to_string(N); while (Q--) { int X; cin >> X; if (X % N == 0) { cout << "Yes\n"; continue; } bool good = false; string T = to_string(X); for (int i = 0; i <= ssize(T) - ssize(S); ++i) { bool match = true; for (int j = 0; j < ssize(S); ++j) { if (S[j] != T[i + j]) { match = false; break; } } if (match) { good = true; break; } } cout << (good ? "Yes\n" : "No\n"); } }