#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int box[10000000];
void soinsuu(ll n){
    for(ll i=2;i*i<=n;i++){
        while(n%i==0){
            box[i]++;
            n/=i;    
        }
        if(n==1)break;
    } 
}
int main(){
    ll n,p;
    cin>>n>>p;
    if(n==1){
        cout<<p<<endl;
        return 0;
    }
    soinsuu(p);
    ll ans=1;
    for(ll i=2;i*i<=p;i++){
        while(box[i]>=n){
            ans*=i;
            box[i]-=n;
        }
    }
    cout<<ans<<endl;
}
