#include <bits/stdc++.h>

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set

using namespace std;

const ll MOD = 1000000007;
const ll INF = (1LL << 62);

ll dp[100005][10];

int main() {
  ll N, K;
  scanf("%lld %lld", &N, &K);

  ll ans = 0;
  for (ll num = K; num <= N + 1; num++) {
    ll start = (0 + num - 1) * num / 2;
    ll end = (N + N - (num - 1)) * num / 2;

    ll plus = (end - start) + 1;

    ans = (ans + plus) % MOD;
  }
  cout << ans << endl;
}
