#include using namespace std; typedef long long int ll; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, Q; cin >> N >> Q; string ns = to_string(N); while (Q--) { ll X; cin >> X; string xs = to_string(X); if (X % N == 0 || xs.find(ns) != string::npos) { cout << "Yes\n"; } else { cout << "No\n"; } } }