#include<bits/stdc++.h>
using namespace std;

#if LOCAL
    #define debug(args...)     (Debugger()) , args
 		class Debugger {
        public:
        Debugger(const std::string& _separator = ", ") :
        first(true), separator(_separator){}
 		template<typename ObjectType>
        Debugger& operator , (const ObjectType& v)
        {
            if(!first) std::cout << separator;
            std::cout << v;
            first = false;
            return *this;
        }
        ~Debugger() {  std::cout << endl;}
 		private:
        bool first;
        std::string separator;
    };
	 template <typename T1, typename T2>
    inline std::ostream& operator << (std::ostream& os, const std::pair<T1, T2>& p)
    {
        return os << "(" << p.first << ", " << p.second << ")";
    }
 	template<typename T>
    inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v)
    {
        bool first = true;
        os << "[";
        for(unsigned int i = 0; i < v.size(); i++)
        {
            if(!first) os << ", ";
            os << v[i];
            first = false;
        }
        return os << "]";
    }
 	template<typename T>
    inline std::ostream &operator << (std::ostream & os,const std::set<T>& v)
    {
        bool first = true;
        os << "[";
        for (typename std::set<T>::const_iterator ii = v.begin(); ii != v.end(); ++ii)
        {
            if(!first) os << ", ";
            os << *ii;
            first = false;
        }
        return os << "]";
    }
	template<typename T1, typename T2>
    inline std::ostream &operator << (std::ostream & os,const std::map<T1, T2>& v)
    {
        bool first = true;
        os << "[";
        for (typename std::map<T1, T2>::const_iterator ii = v.begin(); ii != v.end(); ++ii)
        {
            if(!first)
                os << ", ";
            os << *ii ;
            first = false;
        }
        return os << "]";
    }
 #else
    #define debug(args...)                  // Just strip off all debug tokens
#endif

typedef long long int ll;

#define endl "\n";
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define tr(cont,it) for(decltype((cont).begin()) it = (cont).begin(); it != (cont).end(); it++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())

const ll mod = 1000000007;
const ll inf = (ll)1e15;
ll power(ll a, ll b) { if(b == 0) return 1; if(b == 1) return (a ); ll x = power(a, b / 2); x = (x*x); if(b % 2) x = (x*a); return x;}

ll n,p;
const int N=1e6+5;
bool prime[N];
vector<int> primes;
void solve()
{
	memset(prime,true,N);
	prime[0]=prime[1]=false;
	for(ll i=2;i<N;i++)
	{
		if(prime[i])
		{
			primes.pb(i);
			for(ll j=i*i;j<N;j+=i)
				prime[j]=false;
		}
	}
	cin >> n >> p;
	if(n==1)
	{
		cout << p << endl;
		return;
	}
	ll gcd=1;
	for(ll i=1;i<=1e6;i++)
	{
		if(power(i,n)>p || power(i,n)<=0)
			break;
		if(power(i,n)<=p && (p%(power(i,n))==0))
			gcd=i;
	}
	cout << gcd << endl;
}

int main()
{
	IOS;
	int t = 1, num = 1;   ///// change this t for number of testcase globally
#ifdef LOCAL
   cin >> t;    ///// change this t for number of testcase locally
#endif
    while (t--) 
    {
        solve();
        debug("\n");
    }
	return 0;
}


Measured memory_bytes: 1916