/** * @FileName a.cpp * @Author kanpurin * @Created 2020.09.05 02:38:12 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; template T _pow(T k, U n, T unity = 1) { while (n > 0) { if (n & 1) { unity *= k; } k *= k; n >>= 1; } return unity; } int main() { int n,z;cin >> n >> z; vector p; for (int i = 1; i < z; i++) { p.push_back(_pow(i,n)); } for (int i = 0; i < p.size(); i++) { auto t = lower_bound(p.begin(), p.end(), _pow(z,n)-p[i]); if (t != p.end() && *t == _pow(z,n)-p[i]) { puts("Yes"); return 0; } } puts("No"); return 0; }