#include <iostream>
using namespace std;

const long long MOD = 1000000007;

int main() {
    long long N, K;

    cin >> N >> K;

    long long p;
    for (int i = 0; i < 99; i++) {
        p = (p * 10) % MOD;
    }

    long long sum = 0;

    for (long long k = K; k <= N + 1; k++) {
        long long min = (0 + k - 1) * k / 2;
        long long max = (N + N - k + 1) * k / 2;

        min %= MOD;
        max %= MOD;

        sum += (max - min + 1);
    }

    cout << sum % MOD << endl;
}
