#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  int count = 0;
  for(int i = K; i < N + 1; i++) {
    count = count + (N * (N + 1)) / 2 - ((N-i) * (N - i + 1)) / 2 - (i * (i - 1)) / 2 + 1;
  }
  count++;
  while (count >= 1000000007){
    count %= 1000000007;
  }
  cout << count << endl;
  return 0;
}