#include <bits/stdc++.h>
int main(void) {
  long N, P;
  scanf("%ld %ld", &N, &P);
  long div, ans = 1;
  for (int i = 2; i <= sqrt(P) + 1; i++) {
    div = 0;
    while (P % i == 0) {
      P /= i;
      div++;
    }
    if (div >= N) ans *= i;
  }
  printf("%ld", ans);
  return 0;
}
