#include <stdio.h>

typedef long long ll;

int main(void)
{
	ll n, k, i, ans = 0;

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

	for (i = k; i <= n + 1; i++)
	{
		ll add = (n * (n + 1) / 2 - (n - i) * (n - i + 1) / 2) - (i - 1) * i / 2 + 1;
		ans = (ans + add) % 1000000007;
	}

	printf("%lld", ans);
	return 0;
}