#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  long long i, n, k, f = 1;
  cin >> n >> k;
  long long qzh[n + 2];
  memset(qzh, 0, sizeof(qzh));
  for (i = 2; i <= n + 1; i++) {
    qzh[i] = qzh[i - 1] + f;
    f++;
  }
  long long ans = 0, fst, lst;
  for (i = k; i <= n + 1; i++) {
    fst = qzh[i], lst = qzh[n + 1] - qzh[n + 1 - i];
    ans = (ans + (lst - fst + 1)) % (long long)(mod);
  }
  cout << ans % (long long)(mod) << endl;
  return 0;
}
