#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,Q; cin >> N >> Q; string n = to_string(N); while(Q--){ string s; cin >> s; if(stoi(s)%N == 0) cout << "Yes\n"; else{ bool yes = false; for(int i=n.size(); i<=s.size(); i++){ if(s.substr(i-n.size(),n.size()) == n){yes = true; break;} } if(yes) cout << "Yes\n"; else cout << "No\n"; } } }