#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long n) {
  long long ans = 1;
  while (0 < n) {
    if (n % 2 == 0) {
      a *= a;
      n >>= 1;
    } else {
      ans *= a;
      n--;
    }
  }
  return ans;
}
int main(void) {
  long long n, p, ma = 0, i = 2, ans = 1;
  cin >> n >> p;
  if (n >= 40) {
    cout << 1 << endl;
    return 0;
  }
  if (p % i == 0) {
    ma = max(ma, i);
    long long x = power(i, n);
    while (p % x == 0) {
      ans *= i;
      p /= x;
    }
  }
  while (p % i == 0) p /= i;
  i++;
  while (power(i, n) <= p) {
    if (p % i == 0) {
      ma = max(ma, i);
      long long x = power(i, n);
      while (p % x == 0) {
        ans *= i;
        p /= x;
      }
    }
    i += 2;
    while (p % i != 0) {
      i += 2;
    }
  }
  cout << ans << endl;
  return 0;
}
