fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(" ").map { it.toLong() }
    var total:Long = 0
    for (i in k until n+2){
        val max = ((2 * n - i + 1) * i) / 2
        val min = ((i - 1) * i ) / 2
        total += max - min + 1
    }
    total %= 1000000007
    println(total)
}

