#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

constexpr int MOD = int(1e9) + 7;

// ModInt {{{
template <int64_t MOD>
class ModInt {
    int64_t value;

   public:
    inline ModInt(int64_t val = 0) noexcept
        : value((val >= MOD) ? (val % MOD)
                             : (val < 0) ? ((val % MOD + MOD) % MOD) : val) {}

    template <class IntegerType>
    explicit inline operator IntegerType() const noexcept {
        return static_cast<IntegerType>(value);
    }

    inline ModInt inv() const noexcept {
        return ModInt<MOD>::pow(value, MOD - 2);
    }

    inline ModInt &operator+=(ModInt x) noexcept {
        if ((value += x.value) >= MOD) value -= MOD;
        return *this;
    }
    inline ModInt &operator-=(ModInt x) noexcept {
        if ((value -= x.value) < 0) value += MOD;
        return *this;
    }
    inline ModInt &operator*=(ModInt x) noexcept {
        value = (value * x.value) % MOD;
        return *this;
    }
    inline ModInt &operator/=(ModInt x) noexcept {
        value = (value * x.inv().value) % MOD;
        return *this;
    }

    inline ModInt operator+(ModInt x) const noexcept {
        return ModInt(*this) += x;
    }
    inline ModInt operator-(ModInt x) const noexcept {
        return ModInt(*this) -= x;
    }
    inline ModInt operator*(ModInt x) const noexcept {
        return ModInt(*this) *= x;
    }
    inline ModInt operator/(ModInt x) const noexcept {
        return ModInt(*this) /= x;
    }
    inline bool operator==(ModInt x) const noexcept { return value == x.value; }
    inline bool operator!=(ModInt x) const noexcept {
        return !(this->operator==(x));
    }

    friend ostream &operator<<(ostream &os, ModInt x) noexcept {
        os << x.value;
        return os;
    }

    static constexpr inline ModInt pow(int64_t n, int64_t p) noexcept {
        int64_t ret = 1;
        for (; p > 0; p >>= 1) {
            if (p & 1) ret = (ret * n) % MOD;
            n = (n * n) % MOD;
        }
        return ret;
    }
};
// }}}
using modint = ModInt<MOD>;

i64 sigma(i64 n) { return n * (n + 1) / 2; }

i64 sigma(i64 s, i64 t) { return sigma(t) - sigma(s - 1); }

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    var(i64, N, K);

    dump(N, K);
    modint ans = 0;
    for (int k = K; k <= N + 1; ++k) {
        const modint s = sigma(0, k - 1);
        const modint t = sigma(N - k + 1, N);
        dump(k, s, t);

        ans += t - s + 1;
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 3652