#include<bits/stdc++.h>
using namespace std; 

//int _; 

int n,ans=0,a[3];
string s;
 
int main()
{
	//for(scanf("%d",&_);_;_--)
	long long n,k;
	long long ans=0;
	cin >> n >> k;
	for(long long i=k;i <= n+1;i++)
	{
		ans += (n-i+1)*i+1;
	}
	
	cout << ans%(long long)(10e8+7) << endl;
	return 0;
}