n, l = gets.chomp.split(' ').map(&:to_i)
before_array = (1..n).to_a
after_array = before_array.map { |item| item = item + l - 1 }
abs_array = after_array.map(&:abs)
# abs_array = after_array.map(&:abs)
# min = abs_array.min
after_after_array = after_array.delete_if { |item| item.abs == abs_array.min }
p after_after_array.inject(:+)
