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