#include<stdio.h>
int main(void){
	long long int n,k,ans=0,temp;
	scanf("%lld %lld",&n,k);
	for(int i=k;i<n+2;i++){
		temp=i*(2*n-i+1)/2;
		temp-=i*(i+1)/2;
		ans+=(temp%1000000007);
		ans=ans%1000000007
	}
	printf("%lld",ans);
}