#include "bits/stdc++.h"
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define MOD 1000000007
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);

  long long n;
  cin>>n;

  long long k;  
  cin>>k;  
  //for each interval of i numbers>=k,we can compose every sum from min to max of this size
  long long ans=0; 


 for(long long i=k;i<=n+1;i++){
   		ans+=i*n-i*(i-1)/2 -(i-1)*i/2 +1;  //max sum - min sum+1,max sum being the sum of last i numbers 


 }  

cout<<ans%MOD<<endl;
     
  return 0;
}
