#include <bits/stdc++.h>
using namespace std;
const long long INF = 100000000000000000;
const long long MOD = 1000000007;
const long long MAXN = 100005;
long long dx[] = {0, 0, -1, 1, -1, -1, 1, 1};
long long dy[] = {1, -1, 0, 0, 1, -1, -1, 1};
void solve() {
  long long n, p;
  cin >> n >> p;
  long long ans = 1;
  double power = 1 / (double)(n);
  for (long long i = 1; i <= max(sqrt(p), sqrt(n)); ++i) {
    if (p > i and p % i == 0) {
      long long gcd = p / i;
      long double x = pow(gcd, power);
      if (pow(x, n) != p / i) continue;
      if (floor(x) == ceil(x)) {
        ans = max(ans, (long long)x);
      }
    }
    if (n < i) continue;
    if (p % (n / i) == 0) {
      long long temp = n / i;
      long long gcd = p / temp;
      long double x = pow(gcd, power);
      if (pow(x, n) != p / temp) continue;
      if (floor(x) == ceil(x)) {
        ans = max(ans, (long long)x);
      }
    }
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long t = 1;
  while (t--) solve();
  return 0;
}
