#include <bits/stdc++.h>
using namespace std;
long long pf(long long n) {
  if (n == 1) return 1;
  if (n % 2 == 0) return 2;
  for (long long i = 3; i * i <= n; i += 2) {
    if (n % i == 0) return i;
  }
  return n;
}
int main() {
  long long N, P;
  cin >> N >> P;
  long long ret = 1;
  vector<long long> v;
  long long t = P;
  while (t != 1) {
    long long p = pf(t);
    v.push_back(p);
    t /= p;
  }
  t = 1;
  long long len = 0;
  for (int i = 0; i < (v.size()); i++) {
    if (t == v[i])
      len++;
    else {
      t = v[i];
      len = 1;
    }
    if (len == N) ret *= t;
  }
  cout << ret << endl;
  return 0;
}
