"use strict"
function main(arg) {
    var tmp = arg.trim().split("\n")[0].split(" ").map(Number)
    var N = tmp[0]
    var K = tmp[1]
    var counter = 0
    for (let i = K; i <= N + 1; i++) {
        var min = 0
        var max = 0
        min = sumStep(i - 1)
        max = sumStep(N) - sumStep(N -i)
        counter += (max-min) + 1
        counter %= 1000000007
    }
    console.log(counter)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

function sumStep(n) {
    return (n * (n + 1))/2
}