#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int MAX_L = 1000001;
const int MAX_SQRT_B = 1000001;
bool is_prime_array[MAX_L];
bool is_prime_small[MAX_SQRT_B];
bool is_prime(int n) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return n != 1;
}
vector<int> divisor(int n) {
  vector<int> res;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      res.push_back(i);
      if (i != n / i) res.push_back(n / i);
    }
  }
  return res;
}
map<long long, long long> prime_factor(long long n) {
  map<long long, long long> res;
  for (long long i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ++res[i];
      n /= i;
    }
  }
  if (n != 1) res[n] = 1;
  return res;
}
int eratosthenes(int n) {
  bool is_prime[n + 1];
  memset(is_prime, true, sizeof(is_prime));
  is_prime[0] = is_prime[1] = false;
  int ans = 0;
  for (int i = (int)2; i < (int)n + 1; i++) {
    if (is_prime[i]) {
      ans++;
      for (int j = 2 * i; j <= n; j += i) is_prime[j] = false;
    }
  }
  return ans;
}
long long segment_eratosthenes(long long a, long long b) {
  for (int i = 0; (long long)i * i < b; i++) is_prime_small[i] = true;
  for (int i = 0; i < b - a; i++) is_prime_array[i] = true;
  for (int i = 2; (long long)i * i < b; i++) {
    if (is_prime_small[i]) {
      for (int j = 2 * i; (long long)j * j < b; j += i)
        is_prime_small[j] = false;
      for (long long j = max(2LL, (a + i - 1) / i) * i; j < b; j += i)
        is_prime_array[j - a] = false;
    }
  }
  long long rsl = 0;
  for (int i = (int)0; i < (int)sqrt(b); i++) {
    if (is_prime_array[i]) rsl++;
  }
  return rsl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, pair<int, int>;
  cin >> N >> pair<int, int>;
  if (N == 1) {
    cout << pair<int, int> << endl;
    return 0;
  }
  map<long long, long long> m = prime_factor(pair<int, int>);
  long long rsl = 1;
  for (map<long long, long long>::iterator itr = m.begin(); itr != m.end();
       itr++) {
    if (itr->second >= N) rsl *= itr->first;
  }
  cout << rsl << endl;
}
