#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int main() {
  long long n, p;
  scanf("%lld%lld", &n, &p);
  long long key = p;
  if (p == 1) {
    printf("1\n");
    return 0;
  }
  if (n == 1) {
    printf("%lld\n", p);
    return 0;
  }
  long long ans = 1;
  long long s = 1;
  long long m = (long long)sqrt(p + 0.5);
  for (long long i = 2; i <= m; i++) {
    if (p % i == 0) {
      long long cnt = 0;
      while (p % i == 0) {
        p /= i;
        cnt++;
      }
      s *= (cnt + 1);
      if (cnt >= n) ans = (long long)ans * i * (cnt / n);
    }
  }
  if (p > 1) s *= 2;
  long long k = (long long)pow(ans, n);
  if (key % k == 0)
    printf("%lld\n", ans);
  else
    printf("1\n");
}
