import std.stdio;
import std.algorithm;
import std.conv;
import std.datetime;
import std.numeric;
import std.math;
import std.string;

string my_readln() { return chomp(readln()); }

void main()
{//try{
	auto tokens = split(my_readln());
	auto N = to!ulong(tokens[0]);
	auto P = to!ulong(tokens[1]);

	ulong ans;
	foreach (i; 1..P+1)
	{
		auto j = i;
		if (P % j == 0)
		{
			ulong x = 1;
			bool ng = false;
			foreach (k; 0..N)
			{
				x *= j;
				if (x > P)
				{
					ng = true;
					break;
				}
			}
			if (ng) break;
			
			if (P % x == 0)
			{
				ans = j;
			}
		}
	}

	writeln(ans);
	stdout.flush();
/*}catch (Throwable e)
	{
		writeln(e.toString());
	}
readln();*/
}