#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll ans;
ll M=1000000007;
ll s[200005];
int main(void){
	ll n,k; cin>>n>>k;
	for(int i=1;i<200005;i++){
		s[i]=s[i-1]+i;
	}
	for(int i=k;i<=n+1;i++){
		ans=(ans+(s[n]-s[n-i])-s[i-1]+1)%M;
		//cout<<ans<<endl;
	}
	cout<<ans<<endl;
	
}
