#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

	ll ans = 0;

	for (ll i = k; i <= n + 1; i++) {

		ll minSum = i * (i - 1) / 2;
		ll maxSum = i * n - minSum;

		ans = (ans + (maxSum - minSum + 1) % mod) % mod;

	}

	cout << ans << endl;

    return 0;

}