//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define dl          double
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(int i=a;i<b;i++)
#define lb lower_bound
#define ub upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main(){
	ll n,k,sum=0;cin>>n>>k;
	for(ll i=k;i<=n+1;i++){
		sum=(sum+(n*i%hell-(i-1)*i%hell+hell+1)%hell)%hell;
		//cout<<sum<<endl;
	}
	cout<<sum<<endl;
}
