#include <bits/stdc++.h>
using namespace std;
bool IsPrime(int num) {
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  double sqrtNum = sqrt(num);
  for (int i = 3; i <= sqrtNum; i += 2) {
    if (num % i == 0) {
      return false;
    }
  }
  return true;
}
int main() {
  long long a[1000000], n, p, ans = 1;
  memset(a, 0, sizeof(a));
  cin >> n >> p;
  while (p % 2 == 0) {
    a[2]++;
    p = p / 2;
  }
  if (a[2] / n >= 1) {
    for (int j = 0; j < a[2] / n; j++) {
      ans *= 2;
    }
  }
  for (int i = 3; i <= p; i += 2) {
    if (IsPrime(i) == true) {
      while (p % i == 0) {
        a[i]++;
        p = p / i;
      }
      for (int j = 0; j < a[i] / n; j++) {
        ans *= i;
      }
    }
  }
  cout << ans << endl;
}
