#include <stdio.h>
int main()
{
	int n = 0;
	int k = 0;
	scanf("%d",&n);
	scanf("%d", &k);
	long long sum = 0;
	for (int i = k; i <= n + 1; i++)
	{
		long long tempmin = i * (i-1) / 2;
		long long tempmax = (n * (n + 1) / 2 - (n - i)*(n - i + 1) / 2-i*(i-1)/2+1)%( 1000000000 + 7);
		sum = (sum+tempmax)%(1000000000 + 7);
	}
	printf("%lld",sum);
}