#include <bits/stdc++.h>
using namespace std;
map<long long, long long> prime_facto(long long n, long long nn) {
  map<long long, long long> res;
  for (int i = 2; i * i <= n; i++) {
    long long cnt = 0;
    while (n % i == 0) {
      n /= i;
      cnt++;
    }
    if (cnt >= nn) {
      res[i] = cnt;
    }
  }
  if (n != 1) {
    res[n] = 1;
  }
  return res;
}
void solve1() {
  long long n, p;
  cin >> n >> p;
  map<long long, long long> num;
  num = prime_facto(p, n);
  long long maxnum = 1;
  for (auto itr = num.begin(); itr != num.end(); itr++) {
    maxnum *= itr->first;
  }
  cout << maxnum << endl;
}
int main() { solve1(); }
