#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  int N, K;
  cin >> N >> K;
  long long sum = 0;
  for (int i = K; i <= N + 1; ++i) {
    long long mi = i * (i - 1) / 2;
    long long ma = N * i - i * (i - 1) / 2;
    sum += (ma - mi + 1) % mod;
    sum %= mod;
  }
  sum %= mod;
  cout << sum << endl;
}
