import java.util.*

fun main(args: Array<String>) {
    val argList = Scanner(System.`in`)


    val n = argList.nextInt()
    val l = argList.nextInt()
    val executor = BiteEating()
    println(executor.execute(n, l)) 

}

class BiteEating {
    fun execute(appleArg: Int, tasteArg: Int): Int {
        val tastes = (1..appleArg).toList().mapIndexed { index, i ->
            // Calculate taste
            index to tasteArg + i - 1
        }

        return tastes.map { Math.abs(it.second) to it.second }
                .sortedBy { it.first }
                .drop(1)
                .sumBy { it.second }

//        return (1..appleArg).toList().mapIndexed { index, i ->
//            // Calculate taste
//            index to tasteArg + i - 1
//            // Sort by taste abs asc
//        }.sortedWith(compareBy({ Math.abs(it.second) }, {it.first}))
//                // Smallest taste(abs) will be drop
//                .drop(1)
//                .map { it.second }
//                .sum()

    }
}