#include <stdio.h>
#define mod 1000000007

int main(void) {

	long long n, k, ans = 0;

	scanf("%lld%lld", &n, &k);

	for (; k <= n + 1; k++) {
		ans += (n - k + 1) * k + 1;
		ans %= mod;
	}
	printf("%lld\n", ans);


	return 0;
}