#include <stdio.h>
#define inf 1000000007
typedef long long ll;
ll each(ll n, ll k){return (k*(n-k+1)+1)%inf;}
int main() {
	ll n,k,ans=0;
	scanf("%lld %lld",&n,&k);
	for(ll i=k;i<=n+1;i++){
		ans+=(each(n,i))%inf;
		ans=ans%inf;}

	printf("%lld",ans);
}