private const val MOD = 1000000007L

fun main() {
    val (n, k) = readLine()!!.split(" ").map { it.toLong() }
    val result = (k..n + 1).asSequence().map { (n + 1 - it) * it + 1 }.map { it % MOD }.sum()
    println(result % MOD)
}