#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);
  }
};
bool isPrime[10000001];
vector<long long> vi, pre;
long long n, p;
namespace Rlyeh {
signed call_of_Cthulhu(signed datum) {
  long long n = 10000000;
  isPrime[2] = true;
  for (long long i = 3; i <= n; i += 2) {
    isPrime[i] = true;
  }
  for (long long i = 3; i * i <= n; i += 2) {
    if (isPrime[i]) {
      for (long long j = i * i; j <= n; j += i) {
        isPrime[j] = false;
      }
    }
  }
  vi.push_back(2);
  for (long long i = 3; i <= n; i += 2) {
    if (isPrime[i]) {
      vi.push_back(i);
    }
  }
  cin >> n >> p;
  long long tmp = p;
  for (long long i = 0; i < vi.size(); i++) {
    while (tmp % vi[i] == 0) {
      tmp /= vi[i];
      pre.push_back(vi[i]);
    }
    if (tmp == 1) {
      break;
    }
  }
  if (pre.size() == 0) {
    pre.push_back(p);
  }
  long long prev = 1;
  long long ans = 1;
  long long cnt = 1;
  for (long long i : pre) {
    if (prev != i) {
      prev = i;
      cnt = 1;
    } else {
      cnt++;
    }
    if (cnt == n) {
      ans *= i;
      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;
}
