#include <iostream>

using namespace std;

static long long sum (long long min, long long max) {
    return (min + max) * (max - min + 1) / 2;
}

int main (void) {
    int N, K;
    cin >> N >> K;

    long long ans = 0;
    long long min, max;

    for ( int i=K; i<=N+1; i++ ) {
        min = sum(0, i-1);
        max = sum(N-i+1, N);
        ans += (max - min + 1);
        ans %= 1000000007;
    }

    cout << ans << endl;
    return 0;
}
