#include <bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(ll i =(l);(i)<(r);(i)++)
const ll MOD=1e9+7;
using namespace std;
int main(){
    ll n,k;
    cin>>n>>k;
    ll ans=0;
    rep(num,k,n+2){
        ans+=( ((n+1)*n)/2-((n-num+1)*(n-num))/2-((num-1)*num)/2 )+1;
        ans%=MOD;
    }
    cout<<ans<<endl;
}
