#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(ll i=m;i<(int)(n);i++)
typedef long long ll;
typedef pair<ll,ll> pint;
 
 
int main(){
    ll n,k;cin>>n>>k;
    ll ans=0;
    ll MOD=1000000007;
    ll a;
    ll b;
    REP(i,k,n+2){
        b=((i-1)*i/2);
        a = n*i-b;
        ans+=a-b+1;
        //cout<<a<<" "<<b<<endl;
        //cout<<ans<<endl;
    }
    cout<<ans%MOD<<endl;
}