require 'prime'

n,q = gets.split.map &:to_i

hoge =  Prime::EratosthenesGenerator.new
hoge.upper_bound = 1000000000000

a = q.prime_division(hoge)

result = 1

a.each do |i,j|
    result *= i * (j / n) if j >= n
end

puts result