#include<bits/stdc++.h>
using namespace std;
int mod=1000000007;
#define ll long long
int main(){
	ll n,k;
	cin>>n>>k;
	ll ans=0;
	for(int i=k;i<=(n+1);i++){
		ans = (ans+(((n*(n+1))%mod)/2)%mod+1-(((i*(i-1))%mod)/2)%mod-((((n+1-i)*(n-i))%mod)/2)%mod)%mod;
	//cout<<ans<<endl;
	}
	cout<<ans;
	return 0;
}