#include<bits/stdc++.h>
#define repn(i, n) for (int i = 0; i < (n); i++)
#define repr(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, ...) select(__VA_ARGS__, repr, repn)(i, __VA_ARGS__)
using namespace std;


int main() {
    long long num, K;
    cin >> num >> K;

    long long sum = 0;
    rep(i, K, num + 2) 
    {
        sum = (sum + (i * (num + 1 - i) + 1)) % 1000000007;
    }
    cout << sum << "\n";
    return 0;
}
