#include<stdio.h>
#define LL long long int
#define m 1000000007

LL modadd(LL a, LL b, LL mod){
	/*a + b % mod を出力*/
	LL ret = 0;
	ret = a%mod + b%mod;
	return ret;
}

int main(){
	LL N, K;
	scanf("%lld %lld", &N, &K);
	int i;
	LL ret = 0, e, d;
	for(i = K; i <= N+1; i++){
		d = (i-1)*i / 2;
		e = i*(N + N - i + 1)/2;
		ret = modadd(ret, e - d + 1, m);
	}
	printf("%lld\n", ret);
	
	return 0;
}