// Sakhiya07 - Yagnik Sakhiya
 
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
 
#define mp make_pair
#define bp __builtin_popcountll
#define MOD  1000000007
const int N = 200500;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));

void solve()
{
     ll n,k;
     cin >> n >> k;
     ll ans = 0;
     for(ll i=k;i<=n+1;i++)
     {
          ll mini = (i*(i-1))/2;
          mini %= MOD;
          ll maxi =  (i*n)%MOD - mini + MOD;;
          maxi %= MOD;
          maxi = maxi - mini + MOD;
          maxi %= MOD;
          maxi++;
          ans = (ans + maxi)%MOD;
     }
     cout<<ans;
}

int main()
{
     FAST;
     ll t = 1;
   //  cin >> t;
     while(t--)
     {
          solve();
     }
}