fun main(args: Array<String>) = println(run {
    val (n,l) = readLine()!!.split(" ").map { it.toInt() }

    val taste = (1..n).map { l+it-1 }
    val sum = taste.sum()
    taste.map { sum-it }.minBy { Math.abs(sum-it) }

})
