#include <bits/stdc++.h>

#define forn(i, n) for (int (i) = 0; (i) < (n); ++(i))

using ll=long long;
using ull=unsigned long long;
using ld=long double;
using pii = std::pair<int, int>;
#define x first
#define y second

template<typename T>
static inline T gcd(T a, T b) {
    a = std::abs(a);
    b = std::abs(b);
    while (b > 0) {
        a %= b;
        std::swap(a, b);
    }
    return a;
}

template<typename T>
static inline T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

template<typename T>
static inline T sqr(T a) {
    return a * a;
}

template<typename T>
static inline bool remin(T &a, const T &val) {
    if (a > val) {
        a = val;
        return true;
    }
    return false;
}

template<typename T>
static inline bool remax(T &a, const T &val) {
    if (a < val) {
        a = val;
        return true;
    }
    return false;
}

static inline ll nxt() {
    int64_t x;
    scanf("%" PRId64, &x);
    return x;
}

static inline void skipEndLine() {
    char c = getchar();
    while (c != '\n') {
        c = getchar();
    }
}

static inline std::string nxtLine() {
    std::string ret;
    char c = '\n';
    while (true) {
        c = getchar();
        if (c == '\n' || c == '\r' || c == -1) {
            break;
        }
        ret.push_back(c);
    }
    return ret;
}

static inline std::string nxtString() {
    std::string ret;
    char c = '\n';
    while (true) {
        c = getchar();
        if (!isspace(c)) {
            break;
        }
    }
    if (c == -1) {
        return ret;
    }
    ret.push_back(c);
    while (true) {
        c = getchar();
        if (isspace(c) || c == -1) {
            break;
        }
        ret.push_back(c);
    }
    return ret;
}

static std::chrono::system_clock::time_point clock_t0;

static inline void init_time() {
    clock_t0 = std::chrono::system_clock::now();
}

static inline double get_time() {
    auto t = std::chrono::system_clock::now();
    return std::chrono::duration<double>((t - clock_t0)).count();
}

static inline void print_time(const std::string &name) {
    std::cerr << name << " " << get_time() << "s." << std::endl;
}

template <class T>
static inline T pw(T a, ll n) {
    T ret = T(1);
    while (n > 0) {
        if (n & 1) ret = ret * a;
        a = a * a;
        n >>= 1;
    }
    return ret;
}

static inline ll pw(ll a, ll n, ll m) {
//    if (a == 0) return 0;
    a %= m;
    ll ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * a % m;
        a = a * a % m;
        n >>= 1;
    }
    return ret;
}

static const ld PI = acosl(-1.0);
static std::mt19937_64 generator{123123};

using namespace std;

void prepare() {

}

const ll mod = 1000 * 1000 * 1000 + 7;

void solve(int test) {
    int n = nxt();
    int k = nxt();
    ll low = 0;
    ll high = 0;
    ll ans = 0;
    for (int i = k; i <= n + 1; ++i) {
        ll low = i * 1ll * (i - 1) / 2;
        ll high = i * 1ll * (n + n - i + 1) / 2;
        ans += (high - low + 1) % mod;
    }
    ans %= mod;
    cout << ans << "\n";
}

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    init_time();

    prepare();
    int t = 1;
    // t = nxt();
//    cin >> t;
    for (int i = 0; i < t; ++i) {
        solve(i + 1);
    }

    print_time("Time:");
    return 0;
}


Measured memory_bytes: 3864