#include<stdio.h>
const int mod=1e9+7;
typedef long long ll;
ll n,k;
ll ans;

int main()
{
	scanf("%lld%lld",&n,&k);
	for(ll i=k;i<=n+1;i++)
	{
		ll l=(i-1)*i>>1,r=(n+n-i+1)*i>>1;
		ans+=r-l+1;
		ans%=mod;
	}
	printf("%lld\n",ans);
	return 0;
}
