#include <bits/stdc++.h>
using namespace std;
long long N, P;
long long mypow(unsigned long long i, long long n) {
  long long res = 1;
  if (n > 0) {
    if (n % 2 == 0)
      res = mypow(i * i, n / 2);
    else
      res = mypow(i * i, n / 2) * i;
  }
  return res;
}
int main() {
  cin >> N >> P;
  long long max = 1;
  long long a = 1;
  for (int i = 1; a <= P; i++) {
    a = 1;
    a = mypow(i, N);
    if (P % a == 0) max = i;
  }
  cout << max << endl;
  return 0;
}
