#include<iostream>
#define int long long
#define mod 1000000007
#define puts(x) cout << x << endl
using namespace std;
int ans, n, k;
signed main() {
	cin >> n >> k;
	for (int i = k; i <= n + 1; i++)ans = (ans + i * (n - i + 1) + 1) % mod;
	puts(ans);
}