#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int, int>;
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9 + 7;
void cioacc() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}
ll power(ll a, ll n) {
  ll res = 1, r = a;
  for (; n > 0; n >>= 1, r *= r) res *= (n & 1 ? r : 1);
  return res;
}
int main() {
  ll n, p;
  cin >> n >> p;
  ll ans = 1;
  if (n == 1) {
    cout << p << endl;
  } else if (n >= 40) {
    cout << 0 << endl;
  } else {
    ll i = 1;
    for (; power(i, n) <= p; ++i) {
      ll tmp = power(i, n);
      if (p % tmp == 0) ans = i;
    }
    cout << ans << endl;
  }
}
