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

gcd = 1
2.upto(p) do |i|
  product = p

  if (i ** n) > product
    break
  end

  if product % (i ** n) != 0
    next
  end

  n.times do
    product /= i
  end

  if product <= 0
    next
  end

  gcd = i
end

p gcd
