fun main(args: Array<String>) {
    val l = readLine()!!.split(" ").map { it.toLong() }
    var res = 0L
    for (i in l[1] until l[0]+2) {
        val min = i*(i-1)/2
        val max = l[0]*i - min
        res += max-min+1
    }
    println(res % 1000000007)
}
