io = STDIN
n,m=io.gets.split.map(&:to_i)
def check2(x,m,n)
  return true if (m-x*(n-1)) % x == 0
  false
end
def check1(upper,m,n)
  upper.downto(1).each do |x|
    return x if check2(x,m,n)
  end
end
if m%n==0
  puts m/n
else
  upper=Math.sqrt(m)
  puts check1(upper,m,n)
end
