require "prime"
N, P = gets.chomp.split(' ').map(&:to_i)
# puts "#{N} #{P}"

ans = 1
Prime.prime_division(P).each do |a, n|
    # puts "#{a}^#{n}"
    t = n / N
    ans *= a ** t if t > 0
end
puts ans