#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll const mod = 1e9+7;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    ll ans = 0;
    for(int i = k; i <= n; i++){
        ll L = i * (i-1) / 2;
        ll R = n * i - L;
        ans += R - L + 1;
    }
    cout<<ans%mod<<"\n";

    return 0;
}
