#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 1000000007;
const int MAX = 200000;

int main() {
    int n, k;
    cin >> n >> k;
    ll ans = 0;
    for (int i = k; i <= n + 1; i++) {
        ans += ((ll)i * (n + n - i + 1) / 2) - ((ll)i * (0 + i - 1) / 2) + 1;
        ans %= MOD;
    }
    cout << ans << endl;
}