N, M = gets.split.map(&:to_i)

require 'prime'

puts M == 1 ? 1 : ([[1]] + M.prime_division.map{|a, b| (0 .. b).map{|c| a**c}}).inject(&:product).map{|a| a.flatten.inject(:*)}.sort.reverse.find{|m| M/m >= N}