io = STDIN
n,m=io.gets.split.map(&:to_i)
def check(x,m,n)
  if (m-x*(n-1)) % x == 0
    x
  else
    1
  end
end
if m%n==0
  puts m/n
else
  cand= (1..Math.sqrt(m/n).ceil).map do |x|
    check(x,m,n)
  end
  p cand.max
end
