#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MAX 1000000007
int main(){
  ll n,k,ans=0;
  cin>>n>>k;
  for(ll m=k;m<=n+1;m++){
    ans+=((2*n-m+1)*m/2-(m-1)*(m)/2+1)%MAX;
  }
  cout<<ans%MAX;
    
 
}