#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, P, tmp, boset, ans = 1;
  cin >> N >> P;
  if (N == 1) {
    printf("%lld\n", P);
    return 0;
  }
  boset = 1;
  for (long long i = 1;; i++) {
    boset *= 2;
    tmp = 1;
    for (long long j = 0; j < N; j++) {
      tmp *= boset;
    }
    if (tmp > P) break;
  }
  if (P % 2 == 0) {
    for (long long i = boset; i > 0; i -= 2) {
      tmp = 1;
      for (long long j = 0; j < N; j++) {
        tmp *= i;
      }
      if (P % tmp == 0) {
        ans = i;
        break;
      }
    }
  } else {
    for (long long i = boset - 1; i > 0; i -= 2) {
      tmp = 1;
      for (long long j = 0; j < N; j++) {
        tmp *= i;
      }
      if (P % tmp == 0) {
        ans = i;
        break;
      }
    }
  }
  printf("%lld\n", ans);
}
