import std;

const MOD = 10^^9 + 7;

long calc(int n, int k) {
    long ans = 0;
    for (long i = k; i <= n + 1; i++) {
        long lo = (0 + i - 1) * i / 2;
        long hi = (n - i + 1 + n) * i / 2;
        ans = (ans + hi - lo + 1) % MOD;
    }
    return ans;
}

void main() {
    int n, k; scan(n, k);
    writeln(calc(n, k));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;
