#include "bits/stdc++.h"
using namespace std;
long long rui[1000010];
map<long long, bool>tmp;
signed main() {
	long long n, z; cin >> n >> z;
	bool ok = false;
	if (n == 1) {
		if (z != 1)ok = true;
	}
	else {
		
		for (long long x = 1; x <= 100005; x++) {
			long long now = 1;
			bool ok2 = true;
			for (long long i = 0; i < n; i++) {
				now *= x;
				if (now >= (long long)(1e10)) {
					ok2 = false;
					break;
				}
			}
			if (ok2) {
				rui[x] = now;
			}
			else {
				rui[x] = 100100100;
			}
		}
		for (int x = 1; x <= 100004; x++) {
			if(rui[x] != 100100100 && rui[z]!=100100100 && rui[z] - rui[x] != 0)tmp[rui[z] - rui[x]] = true;
		}
		for (int x = 1; x <= 100004; x++) {
			if (rui[x] != 100100100 && tmp[rui[x]]) {
				//cout << x << endl;
				ok = true;
			}
		}
	}
	if (ok)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}