#include <bits/stdc++.h>
using namespace std;
long long bexp(long long a, long long n) {
  long long ret = 1;
  while (n > 0) {
    if (n & 1) ret = ret * a;
    a = a * a;
    if (a <= 0) return -1;
    assert(a > 0);
    n = n / 2;
  }
  return ret;
}
const int N = 10000005;
int lp[N + 1];
vector<int> pr;
void sieve() {
  for (int i = 2; i <= N; ++i) {
    if (lp[i] == 0) {
      lp[i] = i;
      pr.push_back(i);
    }
    for (int j = 0; j < (int)pr.size() && pr[j] <= lp[i] && i * pr[j] <= N; ++j)
      lp[i * pr[j]] = pr[j];
  }
}
int main() {
  sieve();
  long long n;
  long long p;
  cin >> n >> p;
  long long r = 1;
  long long maxv = p;
  long long i = 0;
  while (p >= maxv && i < pr.size()) {
    if (n < 40)
      maxv = bexp(pr[i], n);
    else {
      r = 1;
      break;
    }
    if (maxv <= 0) {
      break;
    }
    if (p % maxv == 0) {
      p = p / maxv;
      r = r * pr[i];
    } else {
      i++;
    }
  }
  cout << r;
  return 0;
}
