n,p = gets.chomp.split.map(&:to_i)
# max = (p ** (1.0/n)).round
ans = 1

soinsu = []
for i in 2..(p**(1.0/2))
  if p%i == 0
    soinsu.append(i)
    soinsu.append(p/i)
  end
end
soinsu.sort!

soinsu.each do |num|
  if p % (num**n)==0
    ans = num
  end
end

puts ans
