const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const line = input.split(' ');
const N = +line[0];
const K = +line[1];

const sums = [0];
for (let i = 0; i < N + 1; i++) {
    sums.push(i + sums[i]);
}

let sum = 0;
for (let i = K; i <= N + 1; i++) {
    const min = sums[i] - sums[0];
    const maxIndex = sums.length - 1;
    const max = sums[maxIndex] - sums[maxIndex - i];
    sum += (max - min + 1)
}

const MOD = 1000000007;
console.log(sum % MOD);

