require 'prime'
N, P = gets.chomp.split(' ').map(&:to_i)
answer = 1
prime_division = Prime.prime_division(P)
while prime_division.any? { |_, e| e >= N }
  candidate_list = prime_division.select { |n, e| e >= N }
  answer *= candidate_list.map { |n, _| n }.reduce(&:*)
  prime_division = candidate_list.map { |n, e| [n, e - N]}
end
puts answer
