var
	n,p,s:int64;
    f:array[0..1000010] of longint;
    i,t:longint;
begin
	read(n,p);
    if n=1 then
    begin
    	writeln(p);
        halt;
    end;
    fillchar(f,sizeof(f),0);
    i:=1;
    t:=trunc(sqrt(p))+1;
    while (p<>1) and (i<=t) do
    begin
    	inc(i);
        while p mod i=0 do
        begin
        	p:=p div i;
            inc(f[i]);
        end;
    end;
    s:=1;
    for i:=2 to t do
    	if f[i]>=n then s:=s*i;
    writeln(s);
end.