#include <stdio.h>

int main(void)
{
	int N,K,i;
	long long total=0;
	scanf("%d",&N);
	scanf("%d",&K);
	for(i=K;i<=N+1;i++){
		total+=(long long)i*(2*N-(i-1))/2-(long long)i*(i-1)/2+1;
		total=(long long)total%1000000007;
	}
	printf("%lld",total);
	return 0;
}