fun main() {
    val input: List<Long> = readLine()!!.split(" ").map { it.toLong() }
    val allcolum=input[0]+1-input[1]+1
    var ans=0L
    for (i in 0 until allcolum){
        ans+=((input[0]-(input[1]+i)+1)*(input[1]+i)+1)
    }
    println(ans%1000000007)
}