#include <bits/stdc++.h>
using namespace std;
vector<bool> prime;
map<long, long> mp;
void sieve(size_t max) {
  prime.resize(sqrt(max) + 1, true);
  prime[0] = false;
  prime[1] = false;
  for (size_t i = 2; i * i <= sqrt(max); ++i)
    if (prime[i] == true) {
      for (size_t j = 2; i * j <= sqrt(max); ++j) {
        prime[i * j] = false;
      }
    }
}
int main() {
  long n, p;
  cin >> n >> p;
  long ans = 1;
  sieve(p);
  for (long i = 2; i < prime.size(); i++) {
    mp[i] = 0;
    long x = p;
    if (prime[i] == true) {
      for (long j = 2; pow(i, j) <= p; j++) {
        if (x % i == 0) {
          mp[i]++;
          x /= i;
        } else
          break;
      }
      if (mp[i] >= n && mp[i] / n > 1) {
        ans = ans * i * n;
      } else if (mp[i] >= n) {
        ans = ans * i;
      }
    }
  }
  if (n == 1) ans = p;
  cout << ans;
}
