require "prime"
N, P = gets.split.map &:to_i
gcd = 1
tmp= Math.sqrt(P).to_i
if N >= 2
  if N < P
    Prime.each(tmp) do |p|
      if P % (p**N) == 0 
        gcd *= p
      end
    end
  end
  puts gcd
else
  puts P
end
