#include <stdio.h>

int main(){
	int n,k;
	if(scanf("%d %d", &n,&k)==EOF){return 0;}
	int sum = 0;
	int min;
	int max;
	int mod = 1000000007;
	for(int i = k; i <= n+1; i++){
		min = ((i-1)/2*i) % mod;
		max = ((n+1-i + n)/2*i) % mod;
		sum += (max-min +1)% mod;
		sum = sum % mod;
	}
	printf("%d\n", sum);
	return 0;
}