#include <bits/stdc++.h>
using namespace std;
unsigned long long exp(unsigned long long a, unsigned long long b);
unsigned long long sqrtn(unsigned long long n, unsigned long long p);
int main() {
  unsigned long long n, p;
  cin >> n >> p;
  if (n == 1) {
    cout << p << endl;
  } else if (n > 39) {
    cout << "1" << endl;
  } else if (n > 26) {
    if (p % exp(3, n) == 0) {
      cout << "3" << endl;
    } else {
      if (p % exp(2, n) == 0) {
        cout << "2" << endl;
      } else {
        cout << "1" << endl;
      }
    }
  } else {
    vector<bool> vec(sqrtn(n, p));
    for (unsigned long long i = 1; i <= sqrtn(n, p); i++) {
      if (p % exp(i, n) == 0) {
        vec.at(i - 1) = true;
      }
    }
    for (unsigned long long i = sqrtn(n, p) - 1; i >= 0; i--) {
      if (vec.at(i)) {
        cout << i + 1 << endl;
        break;
      }
    }
  }
}
unsigned long long exp(unsigned long long a, unsigned long long b) {
  unsigned long long c = a;
  for (unsigned long long i = 0; i < b - 1; i++) {
    c *= a;
  }
  return c;
}
unsigned long long sqrtn(unsigned long long n, unsigned long long p) {
  if (p == 1) {
    return 1;
  } else {
    for (unsigned long long i = 1; i <= p; i++) {
      if (exp(i, n) > p / 2) {
        return i;
      }
    }
  }
}
