#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) templatebool chmax(T &x, T y){if(x>=y)return false;x=y;return true;} templatebool chmin(T &x, T y){if(x<=y)return false;x=y;return true;} int main(){ int N, Q, X; string s, t; cin >> N >> Q; t = to_string(N); rep(i, Q){ cin >> X; s = to_string(X); if(X%N==0||s.size()>=t.size()&&s.substr(0, t.size())==t||s.size()>=t.size()+1&&s.substr(1, t.size())==t||s.size()>=t.size()+2&&s.substr(2, t.size())==t||s.size()>=t.size()+3&&s.substr(3, t.size())==t)cout << "Yes" << endl; else cout << "No" << endl; } }