let mod = 1000000007

let line = readLine()!.split(separator: " ").map({Int($0)!})
let N = line[0]
let K = line[1]
var ans = 0
for i in K...(N + 1) {
    ans += i * (N + 1 - i) + 1
    ans %= mod
}
print(ans)
