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

  product /= i ** n

  if product < 0
    next
  end

  gcd = i
end

p gcd
