#include #include using namespace std; using namespace atcoder; using mint = modint998244353; //using mint = modint1000000007; typedef long long ll; typedef pair P; typedef tuple T; templatebool chmax(T& a, const T& b) { if (a < b) { a = b;return true; } else { return false; } } templatebool chmin(T& a, const T& b) { if (a > b) { a = b;return true; } else { return false; } } template void dbg(Args&&... args) { ((cout << args << ' '), ...);cout << '\n'; } const int di[] = { -1,0,1,0 }; const int dj[] = { 0,-1,0,1 }; const long long INF = 6000000000000000000; const int inf = 1001001001; int main(void) { int n, q; cin >> n >> q; string s = to_string(n); for (int i = 0; i < q; i++) { int x; cin >> x; string t = to_string(x); bool ok = false; if (x % n == 0)ok = true; for (int j = 0; j < (int)(t.size() - s.size()) + 1; j++) { if (t.substr(j, (int)s.size()) == s)ok = true; } cout << (ok ? "Yes" : "No") << "\n"; } }