#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, M = N, inf = (int)1e9;
const int mod = 1e9 + 7;
int fastAbs(int n) { return (n ^ (n >> 31)) - (n >> 31); }
long long multiply(long long a, long long b) {
  return ((a % mod) * (b % mod)) % mod;
}
long long add(long long a, long long b) {
  return ((a % mod) + (b % mod)) % mod;
}
long long sub(long long a, long long b) {
  return ((a % mod) - (b % mod) + mod) % mod;
}
long long ans;
map<pair<int, int>, int> mp;
const int dx[4] = {1, 0, 0, -1};
const int dy[4] = {0, -1, 1, 0};
vector<int> h[N];
void solve() {
  long long n, p;
  cin >> n >> p;
  if (p == 1) {
    cout << 1;
    return;
  }
  if (n == 1) {
    cout << p;
    return;
  }
  long long ans = 1;
  long long x = p;
  vector<long long> divisior;
  for (long long i = 1; i * i <= p; i++) {
    if (p % i == 0) {
      divisior.push_back(i);
      divisior.push_back(p / i);
    }
  }
  sort((divisior).begin(), (divisior).end());
  divisior.resize(
      distance(divisior.begin(), unique((divisior).begin(), (divisior).end())));
  for (long long i = divisior.size() - 1; i >= 0; i--) {
    long long c = 0;
    while (x % divisior[i] == 0) {
      x /= divisior[i];
      c++;
    }
    x = p;
    if (c >= n) {
      ans = (int)((c / n) * divisior[i]);
      cout << ans;
      return;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int q = 1;
  while (q--) solve();
}
