#include "bits/stdc++.h"
using namespace std;

int64_t mod = 1000000007;

int main()
{
	int64_t n, k;
	cin >> n >> k;

	int64_t ans = 0;
	for (int64_t i = k; i <= n + 1; i++) {
		// (最大-最小)+1個が個数
		int64_t mini = (0 + i - 1) * i / 2;
		int64_t maxi = (n - i + 1 + n) * i / 2;
		int64_t temp = maxi - mini + 1;
		ans += temp;
		ans %= mod;
	}

	cout << ans << endl;
}