#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[1005],b[1005];
ll zyou(ll i,ll n){
	ll k=1;
	while(n>0){
		if(n&1) k=k*i;
		i=i*i;
		n>>=1;
	}
	return k;
}
int main(void){
    ll n,p; cin>>n>>p;
    ll ans=1;
    if(n==1){
		cout<<p<<endl; return 0;
	}
	if(n>=40){
		cout<<1<<endl;
		return 0;
	}
    for(ll i=2;zyou(i,n)<=p;i++){
		while(p%zyou(i,n)==0){
			ans=ans*i;
			p=p/zyou(i,n);
		}
	}
	cout<<ans<<endl;
    
}
