#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b);
long long int bur(long long int N, long long int X);
bool IsPrime(int num);
int main(void) {
  long long int N = 0;
  long long int A = 0;
  long long int B = 0;
  long long int C = 0;
  long long int D = 0;
  long long int P = 0;
  long long int h[1000] = {};
  string S[50], T[50], U[52];
  long long int count = 0;
  long long int count2 = 0;
  float sum = 0;
  long long int min = 1000000000000;
  long long int max = 1;
  long long int smax = 0;
  long long int max2 = 0;
  long long int smax2 = 0;
  int tmax = 0;
  int tmax2 = 0;
  char temp, head;
  bool flag = false;
  long long int all = 0;
  long long int niku = 0;
  long long int state = 2;
  bool down = true;
  vector<pair<int, int>> ch(1000);
  cin >> N >> P;
  if (N == 1) {
    cout << P << endl;
    return 0;
  }
  down = IsPrime(P);
  if (down == true) {
    cout << 1 << endl;
    return 0;
  }
  while (P % 2 == 0) {
    P /= 2;
    if (count != (N - 1)) {
      count++;
    } else {
      max *= 2;
      count = 0;
    }
  }
  count = 0;
  for (int i = 3; i < P; i += 2) {
    while (P % i == 0) {
      P /= i;
      if (count != (N - 1)) {
        count++;
      } else {
        max *= i;
        count = 0;
      }
    }
    count = 0;
    down = IsPrime(P);
    if (down == true) {
      cout << 1 << endl;
      return 0;
    }
  }
  cout << max << endl;
  return 0;
}
long long int bur(long long int N, long long int X) {
  long long int pan = 1;
  long long int pat = 1;
  long long int burg = 0;
  if (X > burg) {
    if (N == 0) return pat;
    burg += pan;
    burg += bur(N - 1, X);
    burg += pat;
    burg += bur(N - 1, X);
    burg += pan;
  }
  return burg;
}
long long int gcd(long long int a, long long int b) {
  if (a < b) {
    long long int tmp = a;
    a = b;
    b = tmp;
  }
  long long int x = b;
  long long int y = a;
  long long int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return y / b * x;
}
bool IsPrime(int num) {
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  double sqrtNum = sqrt(num);
  for (int i = 3; i <= sqrtNum; i += 2) {
    if (num % i == 0) {
      return false;
    }
  }
  return true;
}
