#include <bits/stdc++.h>
using namespace std;
int main() {
  map<long, long> m;
  long n, P, p, d, res = 1;
  cin >> n >> P;
  p = P;
  for (long i = 2; p != 1 && i < P; ++i) {
    d = pow(i, n);
    while (p % d == 0) {
      m[i]++;
      p /= d;
    }
    while (p % i == 0) p /= i;
  }
  for (auto itr = m.begin(); itr != m.end(); itr++) {
    res *= pow(itr->first, itr->second);
  }
  cout << res;
  return 0;
}
