#include <bits/stdc++.h>
using namespace std;
map<long long, long long> prime;
void prime_find(long long n) {
  for (long long i = 2; i <= sqrt(n) + 2; i++) {
    while (n % i == 0) {
      n /= i;
      prime[i]++;
    }
  }
  if (n > 1) prime[n]++;
  return;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, P;
  cin >> N >> P;
  if (N == 1) {
    cout << P << "\n";
    return 0;
  }
  prime_find(P);
  long long ans = 1;
  for (auto& i : prime) {
    if (i.second >= N) ans *= i.first;
  }
  cout << ans << "\n";
  return 0;
}
