#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
#define ll long long
typedef vector<vector<ll> > matrix;
#define pb push_back
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const double PI  =3.141592653589793238463;
long long MOD = 1000000007;

int stringToInteger(string x){
    int gg=0;
    stringstream geek(x);
    geek >> gg;
    return gg;
}

ll powmod(ll a,ll b,ll m)
{
    ll ans=1;
    while(b>0){ if(b%2)
        {ans*=a; ans%=m;}
         b/=2; a=a*a; a=a%m;
        }
        return ans%m;
}
ll gcd(ll a,ll b)
{

    return __gcd(a,b);
}
ll mulmod(ll a,ll b,ll m)
{  ll ans=0;
    a %=m;
    while (b>0)
    {       if(b&1) ans = (ans + a) % m;
        a = (a * 2)%m;
        b /= 2;
    }
    return ans % m;
}

ll f[2000001];



ll pow(ll a, ll b, ll MOD)
{
 ll x=1,y=a;
 while(b > 0)
 	{
 		if(b%2 == 1)
 	{
 		x=(x*y);
 		if(x>MOD) x%=MOD;
 	}
 	y = (y*y);
 	if(y>MOD) y%=MOD;
 	b /= 2;
 	}
 return x;
}

/* Modular Multiplicative Inverse
 Using Euler's Theorem
 a^(phi(m)) = 1 (mod m)
 a^(-1) = a^(m-2) (mod m) */
ll InverseEuler(ll n, ll MOD)
{
 return pow(n,MOD-2,MOD);
}


bool in(float x1,float y1,float x,float y,float r )
{
    if(abs(x1-x)*abs(x1-x)+abs(y1-y)*abs(y1-y)<=r*r) return true;
    return false;
}
bool cmp(pair<int,int> &a,pair<int,int> &b)
{

        return (a.second<b.second);
}
//
//vector<vector<int> >matrix;
matrix mul(matrix A,matrix B)
{
    matrix C(3, vector<ll>(3));
    for(int i=1;i<=2;i++)
    for(int j=1;j<=2;j++)
     for(int k=1;k<=2;k++)
         C[i][j] = (C[i][j] + A[i][k] * B[k][j]);
    return C;

}
matrix pow(matrix A, int p)
{
    if (p == 1)
        return A;
    if (p % 2)
        return mul(A, pow(A, p-1));
    matrix X = pow(A, p/2);
    return mul(X, X);
}
ll fib(int N)
{
    vector<ll> F1(3);
    F1[1] = 1;
    F1[2] = 1;
    matrix T(3, vector<ll>(3));
    T[1][1] = 0, T[1][2] = 1;
    T[2][1] = 1, T[2][2] = 1;
    if (N == 1)
        return 1;
    T = pow(T, N-1);
    ll res = 0;
    for(int i=1;i<=2;i++)
        res = (res + T[1][i] * F1[i]) ;
    return res;
}
ll bit[10005]={0};
ll sum(ll i)
{
    ll ans=0;
    while(i>0)
    {
        ans+=bit[i];
        i-=(i&(-i));
    }
    return ans;
}
ll update(ll n,ll i)
{
    while(i<=n)
    {
        bit[i]+=1;
        i+=(i&(-i));
    }
}
//int C[10005][1];
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
   ll p,n;
   cin>>p>>n;
   ll ans=1;
   map<ll,ll>mp;
   while (n%2 == 0)
    {
        mp[2]++;
        n = n/2;
    }

    // n must be odd at this point.  So we can skip
    // one element (Note i = i +2)
    for (int i = 3; i <= sqrt(n); i = i+2)
    {
        // While i divides n, print i and divide n
        while (n%i == 0)
        {   mp[i]++;
            n = n/i;
        }
    }

    // This condition is to handle the case when n
    // is a prime number greater than 2
    if (n > 2)
        mp[n]++;
        for(map<ll,ll>::iterator it = mp.begin();it!=mp.end();it++)
        {
            if(((it->second)/p) > 0)
            {  //cout<<it->first<<" "<<it->second;
               ans=(ans*pow((it->first),(it->second)/p,100000000000000000));
            }
        }
    cout<<ans;
}
   //C[10005][10005];


Measured memory_bytes: 256