#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const long long INF = 1LL << 60;
using Graph = vector<vector<long long>>;
map<long long, long long> prime;
void prime_factorize(long long n) {
  if (n <= 1) return;
  long long l = sqrt(n);
  for (long long i = 2; i <= l; i++) {
    if (n % i == 0) {
      prime_factorize(i);
      prime_factorize(long long(n / i));
      return;
    }
  }
  prime[n]++;
  return;
}
int main() {
  long long N, p;
  cin >> N >> p;
  prime_factorize(p);
  long long ans = 1;
  for (auto v : prime) {
    if (v.second >= N) ans *= v.first;
  }
  cout << ans << endl;
}
