#include <bits/stdc++.h>
using namespace std;
#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL);

int main() {
  FAST;
  int64_t N, K, A, S;
  cin >> N >> K;
  A = 1000000007LL;
  S = 0LL;
  for (int64_t i = K; i <= N + 1; i++) {
    S += ((i % A) * (N % A)) % A;
    S += - ((i % A)* (i % A)) % A;
    S += i;
    S += 1;
    S %= A; 
  }
  cout << S << endl;
}