#!/usr/bin/env ruby

(n, p) = gets.chomp.split(/ /).map(&:to_i)
array = []
j = p
if (p == 1)
  puts 1
  exit
else
  i = 2
  while (p > 1)
    while (p % i == 0)
      p /= i
      array << i
    end
    i += 1
  end
end
res = {}

array.each do |a|
  res[a].nil? ? res[a] = 1 : res[a] += 1
end

r = 1
res.keys.each do |k|
  if (res[k] / n) > 0
    r *= (k * (res[k] / n))
  end
end

puts r