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

#define lint long long


int main()
{
	lint nn, kk, sum = 0, min, max;
	scanf("%lld %lld", &nn, &kk);
	lint aa[nn + 1];
	for(int ii = kk;ii <= nn;ii++)
	{
		min = (ii - 1) * ii / 2;
		max = ((nn + 1) * nn / 2) - ((nn - ii + 1) * (nn - ii) / 2);
		sum += (max - min + 1);
	}
	
	printf("%lld\n", ((sum+1) % (long long int)(pow(10, 9) + 7)));
	
	return 0;
}