#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, p;
  cin >> n >> p;
  vector<long long> prime;
  if (p % 2 == 0) {
    prime.push_back(2);
    p /= 2;
  }
  for (long long i = 3; i <= p;) {
    if (p % i == 0) {
      prime.push_back(i);
      p /= i;
    } else {
      i += 2;
    }
  }
  long long ans = 1;
  while (prime.size() > 0) {
    long long pr_num = prime[0];
    long long count = count_if(prime.begin(), prime.begin() + n,
                               [pr_num](long long pr) { return pr_num == pr; });
    while (count >= n) {
      ans *= pr_num;
      prime.erase(prime.begin(), prime.begin() + n);
      count -= n;
    }
    prime.erase(prime.begin(), prime.begin() + count);
  }
  cout << ans << endl;
}
