
#include<bits/stdc++.h>
using namespace std;
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define pb push_back
#define F first
#define S second

#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define int long long
#define ll long long
const int M=1e9+7;

int dx[]={1,-1,0,0,1,1,-1,-1};
int dy[]={0,0,1,-1,1,-1,1,-1};

int expo(int x, int y) {int res=1;x=x%M;while(y>0){if(y&1)res=(1ll*res*x)%M;
	y=y>>1;x=(1ll*x*x)%M;} return res;}
	

signed main(){
	gearup;
	int t = 1;
	//cin >> t;
	int store[200005] = {};
	for(int i = 1 ; i < 200005 ; i++)
		store[i + 1] = i * (i + 1) / 2;
	while(t--){
		int n, k, ans = 0;
		cin >> n >> k;
		for(int i = k ; i <= n + 1; i++){
			int temp = store[n + 1] - store[n + 1 - i] - store[i] + 1;
			ans = (ans + temp) % M;
		}
		cout << ans;
	}
	return 0;
}