object Main {
  def main(args:Array[String]) = {
   // val seq = readLine.split("")
    val input=io.Source.stdin.getLines().mkString("\n")
    println(solve(input).toString.trim())
  }


def solve(aaa:String): Int={
  val seq = aaa.split(" ").map(_ .toInt)
  val n = seq(0)
  val l = seq(1)
  val rag= (0 until n).toList.map(_ +l)
  var mins = if (rag.contains(0)){
  	0
  } else if(rag.min > 0 ){
  	rag.min
  }else{
    rag.max
  }
  rag.sum - mins
}
}