#include <bits/stdc++.h>
using namespace std;
uint64_t f(uint64_t x, uint64_t y) {
  if (!y) return 1;
  uint64_t t = f(x, y / 2);
  if (y % 2) {
    return x * t * t;
  } else {
    return t * t;
  }
}
int main() {
  uint64_t n, p;
  cin >> n >> p;
  uint64_t res = 1;
  uint64_t x = 2;
  while (p != 1) {
    uint64_t t = f(x, n);
    if (p < t) break;
    while (p % t == 0) {
      res *= x;
      p /= t;
    }
    ++x;
  }
  cout << res << endl;
  return 0;
}
