#include <bits/stdc++.h>
#include <numeric>
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


using namespace std;

const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;


//#define DEBUG

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ":" << (A) << std::endl;
#else
#define PRINT(A)
#endif

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}


int A, B;
int a[10010][10010], b[1000];
int dp[10010][3];
 
int main()
{
    ll N, K; cin >> N >> K;
    ll sum = 0;
    
    ll upperSum;
    ll lowerSum;

    for(ll k = K; k <= N+1; k++){
        
        upperSum = (N+1)*N/2 -(N-k+1)*(N-k)/2;
        lowerSum = (k)*(k-1)/2;
        PRINT(upperSum)
        PRINT(lowerSum)
        sum += upperSum - lowerSum + 1;
        
        sum = sum % mod;
    }

    cout << sum << endl;
    return 0;
}
