require 'prime'

n, p = gets.split.map(&:to_i)
h = Hash.new(0)
g = Prime::EratosthenesGenerator.new
d = g.next
q = p
while d < Math.sqrt(p)
  while q % d == 0
    h[d] += 1
    q /= d
  end
  d = g.next
end
h[q] += 1 if q > 1
if h == {} || p == 1
  puts 1
elsif n == 1
  puts p
else
  ans = 1
  h.sort_by{|k, v| -v}.each do |k, v|
    while v >= n
      ans *= k
      v -= n
    end
  end
  puts ans
end