n, l = gets.split(" ").map(&:to_i)
array = []
(1..n).each do |i|
  array << i + l - 1
end
(0..(n + l - 1).abs).each do |i|
  index1 = array.find_index(i)
  index2 = array.find_index(-i)
  if index1
    array.delete_at(index1)
    break
  elsif index2
    array.delete_at(index2)
    break
  end
end

puts array.inject(&:+)