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

int main() {
	long int n, k, l, h, a, ans;
	scanf("%ld %ld", &n, &k);
	ans = 0;
	for (long int i = k; i <= n; i++) {
		l = 0;
		h = 0;
		for (long int j = 1; j <= i; j++) {
			l = l + j - 1;
			h = h + n - j + 1;
		}
		a = h - l + 1;
		ans = ans + a;
	}
	ans = (ans + 1) % (10 ^ 9 + 7);
	printf("%ld", ans);
}