require 'prime'
def get(n, p)
  return [p] if p**n <= p
  return [1] if Prime.prime?(p)
  result = []
  2.upto(p/2) do |i|
    break if i**n > p
    result << i if p % i == 0 && p%(i**n)==0
  end
  result
end
n, p = gets.chomp.split(' ').map(&:to_i)
val = get(n, p)
p val.last
