#include <stdio.h>
#define DIV (long) (1e9+7)

int main(void) {
	long n, k;
	scanf("%ld%ld", &n, &k);
	long count = 0;
	for (int i = k; i <= n + 1; i++) {
		count = (count + i * (n - i + 1) + 1) % DIV;
	}
	// k = 2: (2n + 1) - 3 + 1
	printf("%ld\n", count);
	return 0;
}
