#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll n, p, q;
  cin >> n >> p;
  q = p;
  ll memo;
  ll ans = 1;
  if (n == 1)
    cout << p << endl;
  else {
    while (p % 2 == 0) {
      p /= 2;
      memo++;
    }
    if (memo >= n) ans = ans * (n / memo) * 2;
    memo = 0;
    for (ll i = 3; i * i <= p; i += 2) {
      while (p % i == 0) {
        memo++;
        p /= i;
      }
      if (memo >= n) ans = ans * (n / memo) * i;
      memo = 0;
    }
    cout << ans << endl;
  }
}
