#include <bits/stdc++.h>
using namespace std;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int INF = 1 << 29;
struct Utils {
  static long long power(long long x, long long n, long long mod) {
    long long ans = 1;
    while (n > 0) {
      if (n & 1) {
        ans = (ans * x) % mod;
      }
      x = (x * x) % mod;
      n >>= 1;
    }
    return ans;
  }
  static long long power(long long x, long long n) {
    return power(x, n, 1000000007);
  }
  static long long gcd(long long x, long long y) {
    return x % y ? gcd(y, x % y) : y;
  }
  static long long lcm(long long x, long long y) { return (x / gcd(x, y) * y); }
  static bool isMovable(int x, int y, int w, int h) {
    return (x >= 0 && y >= 0 && x < w && y < h);
  }
};
namespace Rlyeh {
long long primeNumbers[2145140];
long long c = 0;
long long p, n;
vector<long long> pre;
void addPrime(long long n) { primeNumbers[c++] = n; }
signed call_of_Cthulhu(signed datum) {
  cin >> n >> p;
  addPrime(2);
  addPrime(3);
  for (long long target = 5; target <= 1000100; target += 2) {
    bool flg = true;
    for (long long i = 1; primeNumbers[i] * primeNumbers[i] <= target; i++) {
      if (target % primeNumbers[i] == 0) {
        flg = false;
        break;
      }
    }
    if (flg) addPrime(target);
  }
  long long tmp = p;
  for (long long i = 0; i < c; i++) {
    while (tmp % primeNumbers[i] == 0) {
      pre.push_back(primeNumbers[i]);
      tmp /= primeNumbers[i];
    }
  }
  long long prev = 1;
  long long ans = 1;
  long long cnt = 0;
  for (long long i : pre) {
    if (prev != i) {
      if (n <= cnt) {
        ans *= prev;
      }
      prev = i;
      cnt = 1;
    } else {
      cnt++;
    }
    if (cnt == n) {
      ans *= prev;
      cnt = 0;
    }
  }
  cout << ans << '\n';
  return 0;
}
}  // namespace Rlyeh
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  Rlyeh::call_of_Cthulhu(114514);
  return 0;
}
