#include // #include // #include using namespace std; // using namespace atcoder; // using bint = boost::multiprecision::cpp_int; using ll = long long; using ull = unsigned long long; using P = pair; #define rep(i,n) for(ll i = 0;i < (ll)n;i++) #define ALL(x) (x).begin(),(x).end() #define MOD 1000000007 int main(){ int a,b; cin >> a >> b; map mp; int k = a; for(int i = 2;i*i <= a;i++){ while(!(k%i)){ mp[i]++; k /= i; } } for(auto au : mp){ int p = au.first; int k = au.second*b; int cnt = 0; while(!(b%p)){ cnt++; b /= p; } if(k != cnt*a){ cout << "No\n"; return 0; } } if(b > 1)cout << "No\n"; else cout << "Yes\n"; return 0; }