#!/usr/bin/env ruby

(n, p) = gets.chomp.split(/ /).map(&:to_i)
array = []
if (n == 1)
  puts p
  exit
end
if (p == 1)
  puts 1
  exit
end

q = p
i = 2
while (i * i < q)
  if(q % i == 0)
    array << i 
    q /= i
  end
  i += 1
end

array2 = []
array.each do |k|
  l = p
  m = 0
  while (l % k == 0)
    l /= k
    m += 1
  end
  array2 << [k, m]
end
r = 1
array2.each do |a|
  v = a[0] * (a[1] / n)
  r *= v if v > 0
end
puts r
