#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long n) {
  if (n = 2) {
    return true;
  }
  for (int i = 2; i < ceil(sqrt(n)); i++) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
unordered_map<long long, long long> factorization(long long n) {
  unordered_map<long long, long long> ret;
  for (long long i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      n = n / i;
      ret[i] += 1;
    }
  }
  ret[n] += 1;
  return ret;
}
int main(void) {
  long long N, P;
  cin >> N >> P;
  auto mp = factorization(P);
  long long gcd = 1;
  for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
    if (itr->second >= N) {
      gcd *= itr->first;
    }
  }
  cout << gcd;
  return 0;
}
