#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) {
      break;
    } else {
      a++;
    }
    if (a * a > P) {
      break;
    }
  }
  if (A.size() == 0) {
    if (N == 1) {
      cout << P << endl;
    } else {
      cout << '1' << endl;
    }
  } else {
    a = 2;
    P = p2;
    vector<long long>(B);
    while (P > 1) {
      if (P % a == 0) {
        S[a]++;
        P /= a;
        (B).push_back((a));
      } else {
        a++;
      }
    }
    long long ans = 1;
    for (int x = 0; x < (B.size()); x++) {
      if (S[B.at(x)] >= N) {
        while (S[B.at(x)] >= N && ans * B.at(x) <= p2) {
          ans *= B.at(x);
          S[B.at(x)] -= N;
        }
      }
    }
    cout << ans << endl;
  }
}
