#include using namespace std; using ll = long long; template istream& operator >> (istream& is, vector& vec) { for(T& x : vec) is >> x; return is; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int a, b, g = 0; cin >> a >> b; vector T(a), S(b); cin >> T >> S; for(auto &&v : T) g = gcd(g, v); for(auto &&v : S) { if(v % g != 0){ cout << "No\n"; return 0; } } cout << "Yes\n"; }