#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
ll mod = 7 + pow(10, 9);
int main() {
  int n, k;
  cin >> n >> k;
  ll ans = 0;
  for (ll i = k; i <= n + 1; i++) {
    ll a = (n - i) * i + i + 1;
    ans += a;
    ans %= mod;
  }
  cout << ans << endl;
}
