#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
int N, K;
cin >> N >> K;
ll sum = 0;
for (ll i = K; i <= N + 1; i++)
{
    sum += i * (N - i + 1) + 1;
    sum %= (1000000000LL + 7);    
}


cout << sum << endl;

}
