#include <bits/stdc++.h>
using namespace std;
vector<bool> prime(1000001, true);
void era() {
  prime[0] = false;
  prime[1] = false;
  for (int i = 2; i <= 1000000; ++i) {
    if (prime[i]) {
      for (int j = i * 2; j <= 1000000; j += i) {
        prime[j] = false;
      }
    }
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n, p;
  cin >> n >> p;
  era();
  vector<long long> cnt(1000001);
  for (long long i = 2; i <= 1000000; ++i) {
    if (prime[i]) {
      while (p % i == 0) {
        cnt[i]++;
        p /= i;
      }
    }
    if (p == 1) break;
  }
  long long ans = 1;
  for (int i = 0; i < (1000001); ++i) {
    if (cnt[i] >= n) {
      ans *= i * (cnt[i] / n);
    }
  }
  cout << ans << endl;
}
