require 'prime'

n, p = gets.split.map(&:to_i)
h = Prime.prime_division(p).to_h
if h == {} || p == 1
  puts 1
elsif n == 1
  puts p
else
  ans = 1
  h.sort_by{|k, v| -v}.each do |k, v|
    ans *= k if v >= n
  end
  puts ans
end