fun main(args: Array<String>) {
    val line = readLine()!!.trim()
    val (n, k) = line.split(" ").map {it.toLong()}

    var answer: Long = 0

    for (kosu in k..n+1) {
        val start = n - (kosu - 1)
        val maximum = ((start + n) * kosu) / 2
        val minimum = ((0 + (kosu - 1)) * kosu) / 2

        answer += (maximum - minimum + 1)
        // println("answer:${answer} n:${n} kosu:${kosu} start:${start} minimum:${minimum} maximum:${maximum}")
        answer = answer % (1000000000 + 7)
    }

    println("${answer}")
}