#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)

int main(){
  ll n,k;
  cin >>n >> k;
  ll sum1=0;
  for(ll i=k; i<=n+1;i++){
	sum1+=i*(n-i+1)+1;
    sum1%=MM;
  }  
   cout << sum1 << endl;    
}