#include <bits/stdc++.h>
using namespace std;
bool prime[1000100];
int32_t main() {
  long long n, p;
  cin >> n >> p;
  if (n == 1) {
    cout << p << endl;
    return 0;
  }
  if (n > 50) {
    cout << 1 << endl;
    return 0;
  }
  prime[0] = prime[1] = true;
  for (long long i = 2; i * i <= 1000100; i++) {
    if (!prime[i]) {
      for (long long j = i * i; j < 1000100; j += i) prime[j] = true;
    }
  }
  long long ans = 1;
  for (long long i = 2; i * i <= p; i++) {
    if (!prime[i]) {
      long long cnt = 0;
      while (p % i == 0) p /= i, cnt++;
      ans = max(ans, ans * i * (cnt / n));
    }
  }
  cout << ans << endl;
}
