#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, P;
  cin >> N >> P;
  if (P == 1 || N == 1) {
    cout << P << endl;
    return 0;
  }
  int a = 2;
  int i = 0;
  int so[100000];
  while (P >= a * a) {
    if (P % a == 0) {
      so[i] = a;
      i++;
      P /= a;
    } else {
      a++;
    }
  }
  so[i] = P;
  int t = 1;
  int ans = 1;
  for (int m = 0; m < i; m++) {
    if (so[m] == so[m + 1]) {
      t++;
      if (t == N) {
        ans *= so[m];
        t = 1;
      }
    } else {
      t = 1;
    }
  }
  cout << ans << endl;
  return 0;
}
