def divisors(n)
  p = []
  2.upto((n**0.5)) do |i|
    break if i > n / i
    while n % i == 0
      p << i
      n /= i
    end
  end
  p << n if n != 1
  p
end
n,p = gets.chomp.split(" ").map(&:to_i)
hash = Hash.new(0)
ans = 1
divisors(p).each do |x|
  hash[x] += 1
  if hash[x] >= n
    ans *= x
    hash[x] = 0
  end
end
puts ans
