n, p = gets.chomp.split.map(&:to_i)

if n == 1
  p p
  exit
end

if p == 1
  p 1
  exit
end

i = 0

while true
  if (i+1) ** n > p
    break
  end

  i += 1
end

i.downto(1) do |u|
  if p % (u ** n) == 0
    p u
    exit
  end
end
