#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) {
  long long g = gcd(a, b);
  return a / g * b;
}
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = (int)1e9;
const long long inf = (long long)1e18;
const int mod = 1000000007;
struct aaa {
  aaa() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} aaaaa;
int main() {
  long long n, p;
  cin >> n >> p;
  if (p == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (n == 1) {
    cout << p << endl;
    return 0;
  }
  map<long long, long long> a;
  for (long long i = 2; i <= sqrt(p); i++) {
    while (p % i == 0) {
      a[i]++;
      p /= i;
    }
  }
  long long ans = 1;
  for (auto it = a.begin(); it != a.end(); it++) {
    if (it->second >= n) {
      ans *= it->first;
    }
  }
  cout << ans << endl;
}
