#include <iostream>
#include <cstdint>

using namespace std;

int main(int argc, char const* argv[]) {
	uint64_t N, K;

	cin >> N;
	cin >> K;

	uint64_t cnt = 0;
	for (uint64_t L = K; L <= N + 1; L++) {
		cnt += (L * (2 * N - L + 1)) / 2 - ((L - 1) * L) / 2 + 1;
		cnt = cnt % (1000000007);
	}

	cout << cnt;

	return 0;
}
