import java.util.Stack

open class ModGroup(val mod: Long, val num: Long) {
    operator fun plus(other: ModGroup): ModGroup {
        if(this.mod != other.mod) {
            throw IllegalArgumentException("mod number has to be equal")
        }
        return ModGroup(this.mod, (this.num + other.num ) % this.mod)
    }

    operator fun minus(other: ModGroup): ModGroup {
        if(this.mod != other.mod) {
            throw IllegalArgumentException("mod number has to be equal")
        }
        return ModGroup(this.mod, (this.num - other.num ) % this.mod)
    }
}
class ModRing(mod: Long, num: Long): ModGroup(mod, num) {
    operator fun times(other: ModGroup): ModRing {
        if(this.mod != other.mod) {
            throw IllegalArgumentException("mod number has to be equal")
        }
        return ModRing(this.mod, (this.num * other.num) % this.mod)
    }
    operator fun div(other: ModGroup): ModRing {
        if(this.mod != other.mod) {
            throw IllegalArgumentException("mod number has to be equal")
        }
        return ModRing(this.mod, (this.num / other.num) % this.mod)
    }
}

fun main(args: Array<String>) {
    val (N, K) = readLine()!!.split(" ").map(String::toLong)
    (K..(N+1)).map { m -> 
        val start = m * (m - 1) / 2  
        val end = N * (N + 1) / 2 - (N - m) * (N - m + 1) / 2 
        ModGroup(1000000007, end - start + 1)
    }.fold(ModGroup(1000000007, 0)) {a, b -> a + b}.let{ it.num }.run(::println)

}