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