#include<iostream>
using namespace std;
#define mod 1000000007
#define int long long int
int32_t main()
{
	int n,k;
	cin>>n>>k;
	int answer=0;
	int j;
	for(j=k;j<=n+1;j++)
	{
		int max=j*n-(j*(j-1))/2;
		int min=(j*(j-1))/2;
		answer=answer+(max-min+1);
		answer=answer%mod;
	}
	cout<<answer<<endl;
}
