#include using namespace std; using ll = long long; ll powll(ll base,ll exp) { ll res = 1; while(exp>0){ if(exp & 1)res = res * base; base = base * base; exp >>= 1; } return res;} ll mod_pow(ll base,ll exp, ll mod) { ll res = 1; while(exp>0){ if(exp & 1)res = res * base % mod; base = base * base % mod; exp >>= 1; } return res % mod;} int main() { int n, z; cin >> n >> z; if(n == 1) { cout << (z != 1 ? "Yes" : "No") << endl; return 0; } ll zs = powll(z, n); for(ll i = 1; i < z; i++) { for(ll j = i; j < z; j++) { ll xs = powll(i, n); ll ys = powll(j, n); if(xs + ys > zs)break; if(xs + ys == zs) { cout << "Yes" << endl; return 0; } } } cout << "No" << endl; }