require "prime"

class Integer
  def divisors
    prime_division.inject([1]) do |ary, (p, e)|
      (0..e).map{ |e1| p ** e1 }.product(ary).map{ |a, b| a * b }
    end.sort
  end
end

n, m = gets.split.map(&:to_i)

m.divisors.each do |k|
  next if k < n
  puts m / k
  exit
end