#include <bits/stdc++.h>
using namespace std;
inline long pow(long a, long b) {
  long ret{1};
  for (long i{}; i < b; ++i) {
    ret *= a;
  }
  return ret;
}
int main() {
  long N, P;
  scanf("%ld%ld", &N, &P);
  long factor{1};
  long prime{2};
  long tmp{};
  while (P >= (tmp = pow(prime, N))) {
    if (P % tmp == 0) {
      P /= tmp;
      factor *= prime;
    } else {
      while (++prime % 2 == 0)
        ;
    }
  }
  printf("%ld\n", factor);
  return 0;
}
