#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N, P;
  cin >> N >> P;
  vector<pair<long long int, long long int>> v;
  long long int a = 2;
  long long int num = 0;
  while (P >= a * a) {
    if (P % a == 0) {
      P /= a;
      num++;
    } else {
      if (num > 0) {
        v.push_back(make_pair(num, a));
        num = 0;
      }
      a++;
    }
  }
  if (num > 0) {
    if (a == P) {
      v.push_back(make_pair(num + 1, a));
    } else {
      v.push_back(make_pair(num, a));
      v.push_back(make_pair(1, P));
    }
  } else {
    v.push_back(make_pair(1, P));
  }
  sort(v.begin(), v.end(), greater<pair<long long int, long long int>>());
  long long int ans = 1;
  for (long long int i = 0; i < v.size(); i++) {
    if (v[i].first >= N) {
      ans *= v[i].second * (v[i].first / N);
    }
  }
  cout << ans << endl;
  return 0;
}
