object Main extends App {
  val List(n,k) = io.StdIn.readLine.split(" ").toList.map(_.toLong)

  var t = 0L
  (k to n+1).foreach{i =>
    val min = 1L*(0 + (i-1))*i / 2L
    val max = 1L*( n + (n-i+1) )*i / 2L
    t += max - min + 1
  }
  println(t % (1000000000L + 7))
}