#include <bits/stdc++.h>
using namespace std;
long long fastpow(long long x, long long n) {
  if (n == 0) return 1;
  if (n % 2 == 1)
    return x * fastpow(x, n - 1);
  else {
    long long ret = fastpow(x, n / 2);
    return ret * ret;
  }
}
vector<long long> prime;
int main() {
  long long n, p;
  cin >> n >> p;
  for (long long i = 1; i * i <= p; i++) {
    if (p % i == 0) {
      prime.push_back(i);
      prime.push_back(p / i);
    }
  }
  sort(prime.rbegin(), prime.rend());
  for (int i = 0; i < prime.size(); i++) {
    long long x = pow(1.0 * prime[i], 1.0 / n);
    if (fastpow(x, n) == prime[i]) {
      cout << x;
      return 0;
    }
  }
}
