#include <bits/stdc++.h>
using namespace std;
bool isPrime[1000100];
long long cntFactors[1000100];
long long lcm = 1;
signed main() {
  int n = 1000000;
  isPrime[2] = true;
  for (int i = 3; i < n; i += 2) {
    isPrime[i] = true;
  }
  for (int i = 3; i * i <= n; i += 2) {
    if (isPrime[i]) {
      for (int j = i * i; j <= n; j += i) {
        isPrime[j] = false;
      }
    }
  }
  long long N, P;
  cin >> N >> P;
  while (P % 2 == 0) {
    P /= 2;
    cntFactors[2]++;
  }
  lcm *= max(1ll, 2 * (cntFactors[2] / N));
  for (int i = 3; i <= P; i += 2) {
    if (i > 1000000) {
      if (N == 1)
        cout << lcm * P << endl;
      else {
        cout << lcm << endl;
      }
      return 0;
    }
    if (isPrime[i]) {
      while (P % i == 0) {
        cntFactors[i]++;
        P /= i;
      }
      lcm *= max(1ll, i * (cntFactors[i] / N));
    }
  }
  cout << lcm << endl;
  return 0;
}
