object Main extends App {
  val List(n,k) = io.StdIn.readLine.split(" ").toList.map(_.toInt)
  
  val l = (0 to n).toList
  
  var t = 0
  (k to n+1).foreach{i =>
    //t += l.combinations(i).map(_.sum).toSet.size
    val min = l.take(i).sum
    val max = l.reverse.take(i).sum
    t += max - min + 1
  }
  println(t)
}