#include <bits/stdc++.h>
using namespace std;
class Calc {
  long long a;

 public:
  void decompositPrime(long long a, long long b);
};
void Calc::decompositPrime(long long n, long long number) {
  if (number != 1 && number * number != n) {
    long long re = 1;
    a = 2;
    long long count = 0;
    while (n >= a * a) {
      if (n % a == 0) {
        count++;
        n /= a;
      } else {
        if (count >= number) {
          re = re * a;
        }
        count = 0;
        a++;
      }
    }
    if (n == a) count++;
    if (count >= number) {
      re = re * a;
    }
    cout << re;
  } else if (number == 1) {
    cout << n;
  } else {
    cout << number;
  }
}
int main() {
  long long iNum, n;
  Calc objCalc;
  cin >> n >> iNum;
  objCalc.decompositPrime(iNum, n);
  return 0;
}
