#include<bits/stdc++.h>
#define    ll      unsigned long long int
#define    Fori(a,b) for (ll i = a ; i<b ;i++ )
#define    Forj(a,b) for (ll j = a ; j<b ;j++ )
#define    Fork(a,b) for (ll k = a ; k<b ;k++ )
#define    W       while
#define    pb      push_back
#define    nl      cout<<endl
#define    mod     1000000007
#define    I       cin>>
#define    Out     cout<<
#define    DOD(i)  cout<<setprecision(i)<<fixed<<
#define    XXX     return 0
#define    Fast    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
using namespace std;
int main()
{
   Fast;
   ll n,k;I n>>k;
   if(k>n){
       cout<<1<<endl;
   }else{
       ll ans=0;
       for(int i=k;i<=n;i++){
           ll f=k*(k+1)/2;
           ll s=(n+1)*(n+2)/2 - (n-k+1)*(n-k+2)/2;
           ans += s-f+1; 
       }
       cout<<ans%mod<<endl;
   }
   XXX;
}


