n,num=gets.chomp.split(" ").map(&:to_i)
np = num
result = []
i = 2
while i <= np do
  if np % i == 0
    result << i
    np = np / i
  else
    i += 1
  end
end
s_r = result.uniq
c = 1
s_r.each do |i|
  c = c * i if n <= result.count(i)
end

if num == 1
 puts 1
elsif n == 1
 puts num
else
 puts c
end