fun main(args: Array<String>) {
    val (N, L) = readLine()!!.split(" ").map(String::toInt)

    val a = (1..N).map { it + L - 1 }.toMutableList()
    val b = a.mapIndexed { i, e -> Pair(i, Math.abs(e)) }.sortedBy { it.second }.first()
    a.removeAt(b.first)
    a.sum().let(::println)

}