#include using namespace std; using ll = long long; [[maybe_unused]] constexpr ll INF = (1LL << 60) - 1; void solve() { ll n, q; cin >> n >> q; string sn = to_string(n); ll ln = sn.size(); while (q--) { ll x; cin >> x; string sx = to_string(x); ll lx = sx.size(); bool f = x % n == 0; for (ll i = 0; i < lx - ln + 1; ++i) { f |= sx.substr(i, ln) == sn; } cout << (f ? "Yes\n" : "No\n"); } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll t = 1; // cin >> t; while (t--) { solve(); } return 0; }