#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int MOD = 1000000007;
int main(int argc, char const* argv[]) {
  long long n, p;
  cin >> n >> p;
  if (n == 1) {
    cout << p << endl;
    return 0;
  }
  map<long long, long long> so;
  so[p]++;
  long long pp = p;
  for (int i = 2; i <= sqrt(pp) + 1; i++) {
    if (p % i == 0) {
      so[i]++;
      p /= i;
      i--;
    }
  }
  long long ans = 1;
  for (auto&& var : so) {
    for (int i = n; var.second >= i; i += n) {
      ans *= var.first;
    }
  }
  cout << ans << endl;
  return 0;
}
