require 'prime'

input = STDIN.read.chomp.split(" ")

N = input[0].to_i
P = input[1].to_i
d = Prime.prime_division(P)

primes = []

if d.length == 0 
  puts 1
elsif N == 1
  puts P
else
  d.sort_by{|r| r[0]}.reverse.each{|r|
    if r[1] >= N
      primes.push(r[0])
    end
  }
  puts primes.reduce(1){|a, b| a * b}
end

