#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const long long int MOD = 1000000000000000001;
long long int Len(long long int n) {
  long long int s = 0;
  while (n != 0) s++, n /= 10;
  return s;
}
long long int Sint(long long int n) {
  long long int m = 0, s = 0, a = n;
  while (a != 0) s++, a /= 10;
  for (long long int i = s - 1; i >= 0; i--)
    m += n / ((long long int)pow(10, i)) -
         (n / ((long long int)pow(10, i + 1))) * 10;
  return m;
}
long long int Svec(vector<long long int> v) {
  long long int n = 0;
  for (long long int i = 0; i < v.size(); i++) n += v[i];
  return n;
}
long long int GCD(long long int a, long long int b) {
  long long int r, tmp;
  if (a < b) {
    tmp = a, a = b, b = tmp;
  }
  r = a % b;
  while (r != 0) {
    a = b, b = r, r = a % b;
  }
  return b;
}
long long int LCM(long long int a, long long int b) {
  long long int c = a, d = b, r, tmp;
  if (a < b) {
    tmp = a, a = b, b = tmp;
  }
  r = a % b;
  while (r != 0) {
    a = b, b = r, r = a % b;
  }
  return c / b * d;
}
long long int Factorial(long long int n) {
  long long int m = 1;
  while (n >= 1) m *= n, n--;
  return m;
}
vector<pair<char, long long int>> runlength(
    string s, vector<pair<char, long long int>> p) {
  long long int x = 1;
  if (s.size() == 1) {
    p.push_back(pair<char, long long int>(s[0], 1));
    return p;
  }
  for (long long int i = 0; i < s.size() - 1; i++) {
    if (s[i] == s[i + 1]) {
      x++;
      if (i == s.size() - 2) {
        p.push_back(pair<char, long long int>(s[i], x));
      }
    } else {
      p.push_back(pair<char, long long int>(s[i], x));
      x = 1;
      if (i == s.size() - 2) {
        p.push_back(pair<char, long long int>(s[s.size() - 1], x));
      }
    }
  }
  return p;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n, p, ans = 1;
  cin >> n >> p;
  map<long long int, long long int> mp;
  vector<long long int> v;
  if (n == 1) {
    cout << p << endl;
    return 0;
  }
  for (long long int i = 2; i <= sqrt(p); i++) {
    while (p % i == 0) {
      mp[i]++;
      p /= i;
    }
    if (p == 1) break;
  }
  for (auto c : mp) {
    if (c.second >= n) {
      ans *= c.first;
    }
  }
  cout << ans << endl;
}
