import kotlin.math.pow

private fun readLn(): String = readLine()!!
private fun readInt(): Int = readLn().toInt()
private fun readStrs(): List<String> = readLn().split(" ")
private fun readInts(): IntArray = readStrs().map { it.toInt() }.toIntArray()
private fun readChars(): CharArray = readStrs().map { it.single() }.toCharArray()

fun main(args: Array<String>) {
    val (N, K) = readInts()
    val mod = 10.0.pow(9).toLong() + 7

    var sum = 0L
    for (k in K..(N + 1)) {

        val index = k.toLong()
        val min = index * (index - 1) / 2
        val b =  index.toLong() * (2 * N - index + 1)
        val a = b / 2

        val max = b / 2
        sum += (max - min + 1)
    }
    println(sum % mod)
}