#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

#define MOD 1000000007

int main(void){
	long long  n, k;
	scanf("%lld%lld",&n ,&k);
	long long sum = 0;
	long long s;
	while(k<=n+1){
		s = k*n + k - k*k + 1;
		s = s%MOD;
		if(s<0)
		printf("%lld\n",s);
		sum += s;
		sum = sum%MOD;
		k++;
	}
	printf("%lld\n",sum);
    return 0; 
}
