require "prime"

n, m = gets.chomp.split.map(&:to_i)
if Prime.prime?(m)
  puts 1
  exit
end

ans = 1
(m/n).step(1, -1) do |i|
  next if m/i != m/(i.to_f)
  next if m/i < n

  ans = i
  break
end

puts ans