#include <bits/stdc++.h>
using namespace std;
long long n, p, ans = 1;
template <typename T>
inline void in(T &x) {
  T ch = getchar(), f = 1;
  x = 0;
  while (!isdigit(ch)) f = ch == '-' ? -1 : f, ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  x *= f;
}
long long cal(long long x, long long y) {
  long long z = 1;
  while (y) {
    if (y & 1) z *= x;
    x *= x;
    y >>= 1;
  }
  return z;
}
signed main() {
  in(n), in(p);
  long long i = 2;
  while (1) {
    long long x = cal(i, n);
    if (x > p) break;
    if (p % x) {
      i++;
      continue;
    }
    ans *= i;
    p /= x;
  }
  cout << ans;
  return 0;
}
