#include<stdio.h>
int main(void)
{
	unsigned long int a, b, c, d, e;
	unsigned long int i, j;
	unsigned long int sum = 0;

	scanf("%ld", &a);
	scanf("%ld", &b);
	for (i = b; i <= (a + 1); i++) {
		c = 0;
		d = 0;
		for (j = 0; j < i; j++) {
			c = c + j;
			d = d + (a - j);
		}

		sum = sum + d - c + 1;
	}

	sum = sum % (1000000000 + 7);

	printf("%ld", sum);

	return 0;
}