#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int ll; typedef pair Pii; const ll mod = 998244353; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, q; cin >> n >> q; vector x(q); for (auto &y: x) cin >> y; vector ans(q); for (int i = 0; i < q; i++) { if (x[i] % n == 0) { ans[i] = "Yes"; continue; } auto xs = to_string(x[i]); auto ns = to_string(n); if (xs.find(ns) != string::npos) { ans[i] = "Yes"; } else { ans[i] = "No"; } } for (auto &y: ans) cout << y << endl; return 0; }