#include <bits/stdc++.h>
using namespace std;
map<long long, long long> prime_factor(long long n) {
  map<long long, long long> res;
  for (long long i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ++res[i];
      n /= i;
    }
  }
  if (n != 1) res[n] = 1;
  return res;
}
int main(int argc, char const *argv[]) {
  long long n, p;
  cin >> n >> p;
  map<long long, long long> mp;
  mp = prime_factor(p);
  long long ans = 1;
  for (auto x : mp) {
    if (x.second >= n) ans *= x.first;
  }
  cout << ans << endl;
  return 0;
}
