#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, P;
  cin >> N >> P;
  long long p2 = P;
  map<long long, int> S;
  vector<long long>(A);
  long long a = 2;
  while (P > 1) {
    if (P % a == 0) {
      S[a]++;
      (A).push_back((a));
      P /= a;
    } else {
      a++;
    }
    if (a * a > p2) {
      break;
    }
  }
  sort((A).begin(), (A).end());
  reverse((A).begin(), (A).end());
  long long ans = 1;
  for (int x = 0; x < (A.size()); x++) {
    if (S[A.at(x)] >= N) {
      ans *= A.at(x);
      S[A.at(x)] = 0;
    }
  }
  cout << ans << endl;
}
