#include <bits/stdc++.h>
const int INF = 1 << 29;
const double EPS = 1e-9;
using namespace std;
void prime_factorization(long long n, map<long long, long long>& factors) {
  long long count = 0;
  for (long long div = 2; div * div <= n; ++div) {
    if (n % div == 0) {
      count = 0;
      while (1) {
        ++count;
        n /= div;
        if (n % div != 0) {
          factors[div] = count;
          break;
        }
      }
    }
  }
  if (n != 1) factors[n] = 1;
}
int main(void) {
  long long n, p;
  cin >> n >> p;
  if (n == 1) {
    cout << p << endl;
    return 0;
  }
  map<long long, long long> factors;
  prime_factorization(p, factors);
  long long ans =
      accumulate((factors).begin(), (factors).end(), (long long)1,
                 [n](long long sum, pair<long long, long long> p) {
                   return p.second >= n ? sum * p.first * (p.second / n) : sum;
                 });
  cout << ans << endl;
  return 0;
}
