#include <stdio.h>
#define inf 1000000007
typedef long long ll;

ll ret(ll n,ll k) {
	return (k*(n-k+1)+1) % inf;
}

int main() {
	ll n,k,ans=0;
	scanf("%lld %lld", &n, &k);
	for (int i = k; i <= n+1; i++) {
		ans += (ret(n, i)) % inf;
	}
	ans = ans % inf;
	printf("%lld", ans);
}