N,M = gets.split.map(&:to_i)
require 'prime'
class Integer
  def divisor_list
    return [1] if self == 1
    (1..Math.sqrt(self).to_i).select do |i|
      self%i == 0
    end.map {|e| [e, self/e]}.flatten.uniq.sort
  end
end
puts M.divisor_list.find_all{|i|i<M/N+1}.max
  