#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
template <class T>
bool chmin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool chmax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
template <class T>
ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << " ";
    os << *it;
  }
  return os;
}
ll N, P;
signed main() {
  cin >> N >> P;
  if (N == 1) {
    cout << P << endl;
    return 0;
  }
  for (ll i = (ll)((ll)sqrt(P) + 1) - 1; i >= 0; i--)
    if (P % i == 0) {
      ll j = 1;
      bool bf = true;
      for (ll _ = 0; _ < (ll)(N); _++) {
        if (j > P) {
          bf = false;
          break;
        }
        j *= i;
      }
      if (bf && P % j == 0) {
        cout << i << endl;
        return 0;
      }
    }
}
