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