#include <stdio.h>
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <math.h>
using namespace std;
//整形Shift + alt + f　2回
//int x[101],y[101],h[101];
//int koya[100001][];
/*
//ユークリッドの互除法
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
*/

/*
//桁数取得
unsigned GetDigit(unsigned num)
{
    unsigned digit = 0;
    while (num != 0)
    {
        num /= 10;
        digit++;
    }
    return digit;
}
*/

long long int n;
long long int p;

// index が条件を満たすかどうか
bool isOK(int index)
{
    long double tmp = pow((double)index, n);
    //i^n が pを超えるか
    if (p < tmp)
        return true;
    else
        return false;
}

// 汎用的な二分探索のテンプレ
long long int binary_search()
{
    long long int left = 1;
    long long int right = p;

    while (right - left > 1)
    {
        long long int mid = left + (right - left) / 2;
        if (isOK(mid))
            right = mid;
        else
            left = mid;
    }

    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    return;
}

int main()
{
    cin >> n >> p;

    long long int res = -1;

    long long int b = binary_search();

    if (n == 1)
    {
        cout << p;
        return 0;
    }

    if (p == 1)
    {
        cout << 1;
        return 0;
    }

    for (int i = b; i > 0; i--)
    {
        long double tmp = pow((double)i, n);
        if (p % (long long int)tmp == 0)
        {
            res = i;
            break;
        }
    }

    cout << res;

    return 0;
}
