#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N, P, PP, max = 0;
  cin >> N >> P;
  long long int count = 0, P_P = P;
  for (int i = 0; i < N; i++) {
    if (P_P % 2 == 0) {
      P_P /= 2;
      count++;
    }
  }
  double A;
  A = pow((double)P_P, (double)1 / N);
  int A_i = 0;
  double A_p = 0;
  for (int i = 0; i < A; i++) {
    A_i = (int)A - i;
    A_p = pow((double)A_i, (double)N);
    if (P_P % (long long int)A_p == 0) {
      max = A_i;
      break;
    }
  }
  if (count >= N) {
    cout << max * pow(2, (int)(count / N)) << endl;
  } else {
    cout << max << endl;
  }
  return 0;
}
