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

if m % n == 0
  puts m / n
  exit
end

result = 1
1.upto(Math.sqrt(m).to_i).each do |i|
  if m % i == 0
    rest = m / i
    result = i if rest >= n
  end
end
puts result
