def ascan; gets.split.map(&:to_i); end

require 'prime'

N, P = ascan

if N == 1
    p P
    exit
end

ans = 1
Prime::prime_division(P).each do |q, m|
    if m >= N
        ans *= q*(m/N)
    end
end

p ans