fun main() {
    val mod = 1000000007
    val (N, K) = readLine()!!.split(" ").map(String::toInt)
    var sum = 0L

    for (i in K..N + 1) {
        val j = i.toLong()
        val min = j * (j - 1) / 2
        val max = (N * 2 - j + 1) * j / 2
        sum += (max - min + 1)
        sum %= mod
    }

    println(sum)
}

