#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K, memo, answer;
  cin >> N >> K;
  answer = 0;
  for (int i = K; i <= N + 1; i++) {
    memo = N * i - i * i + i + 1;
    answer += memo % 1000000007;
  }
  cout << answer << endl;
}
