#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
//int T[2005]={0};
int main(){
  ll n ,j ;
  cin>>n>>j;
ll ans=0;
  for(ll k=j;k<=n+1;k++){
  ll a=(((k-1)*k)/2)%MOD;
  ll b=(((n+n-k+1)*k)/2)%MOD;
  ans+=(b-a+1+MOD)%MOD;
  ans%=MOD;
  ///cout<<" "<<ans<<endl;
}

    cout<<ans<<endl;
}