
fun main(args:Array<String>) {
    val (N,L) = readLine()!!.split(" ").map(String::toInt)
    val tastes = (1..N).map {
        L + it - 1
    }

    val total = tastes.fold(0) {sum,ele -> sum+ele}

    tastes.indices.minBy {
        val ts = tastes[it]
        Math.abs(ts)
    }!!.let {
        total - tastes[it]
    }.run(::println)
}
 