#include <stdio.h>

#define Mod 1000000007

int main()
{
	int N, K;
	scanf("%d %d", &N, &K);
	
	int i;
	long long ans = 0;
	for (i = K; i <= N + 1; i++) ans = (ans + ((long long)N * 2 - i + 1) * i / 2 - (long long)i * (i - 1) / 2 + 1) % Mod;
	printf("%lld\n", ans); 
	fflush(stdout);
	return 0;
}