#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n = 0;
  long long p = 0;
  long long i = 0;
  cin >> n >> p;
  long long n_ori = n;
  long long p_ori = p;
  bool ok = true;
  long long ret = p;
  while (p < (ret ^ n) && ret != 1) {
    ret = sqrt(ret);
  }
  for (; 0 < ret; --ret) {
    ok = true;
    p = p_ori;
    for (i = 0; i < n; ++i) {
      if (p % ret != 0) {
        ok = false;
        break;
      }
      p /= ret;
    }
    if (ok) {
      break;
    }
  }
  cout << ret;
  return 0;
}
