#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define hell  1000000007
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb   push_back

int main()
{
	ios;
	ll n,k,sum=0;
	cin>>n>>k;
	for(ll i=k;i<=n+1;i++)
	{
		sum+=(i*((2*n)-i+1))/2-((i*(i-1))/2)+1;
	}
	cout<<sum%hell;
}