#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

const int mod = 1e9 + 7;
long long n, k;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> k;
	long long sum = 0;
	for(long long i = k; i <= n + 1; i++){
		long long low = (i * (i - 1)) / 2;
		long long high = (i * (n + n - i + 1)) / 2;
		sum = (sum + (high - low + 1) % mod) % mod;
	}
	cout << sum << "\n";
	return 0;
}