mod = 10**9 + 7



n,k = list(map(int,input().split()))

tot = []

cur = 0

for i in range(n+1):

    cur += i

    tot.append(cur)



cnt = 0

for i in range(k, n+2):

    if n > i:

        max_ = tot[n] - tot[n - i]

    else:

        max_ = tot[n]

    min_ = tot[i - 1]

    cnt += max_ - min_ + 1

    cnt %= mod

print(cnt)
# しゃくとり



mod = 10**9 + 7



n,k = list(map(int,input().split()))



cnt = 0

sum_ = sum(range(n + 1))

#print("sum", sum_)

#print(list(range(n + 1)))

max_ = sum(range(n - k + 1, n + 1))

min_ = sum(range(k))

for i in range(k, n+2):

    #print(max_, min_, cnt)

    cnt += max_ - min_ + 1

    cnt %= mod

    #print(cnt)

    

    if n > i + 1:

        max_ +=  n - i

    else:

        max_ = sum_

    min_ += i

print(cnt)
mod = 10**9 + 7
n, k = list(map(int, input().split()))
tot = []
cur = 0
for i in range(n + 1):
    cur += i
    tot.append(cur)
cnt = 0
for i in range(k, n + 2):
    if n > i:
        max_ = tot[n] - tot[n - i]
    else:
        max_ = tot[n]
    min_ = tot[i - 1]
    cnt += max_ - min_ + 1
    cnt %= mod
print(cnt)

# しゃくとり
mod = 10**9 + 7
n, k = list(map(int, input().split()))
cnt = 0
sum_ = sum(range(n + 1))
# print("sum", sum_)
# print(list(range(n + 1)))
max_ = sum(range(n - k + 1, n + 1))
min_ = sum(range(k))
for i in range(k, n + 2):
    # print(max_, min_, cnt)
    cnt += max_ - min_ + 1
    cnt %= mod
    # print(cnt)
    if n > i + 1:
        max_ += n - i
    else:
        max_ = sum_
    min_ += i
print(cnt)

+# しゃくとり -tot = [] -cur = 0 -for i in range(n + 1): -    cur += i -    tot.append(cur) +sum_ = sum(range(n + 1)) +# print("sum", sum_) +# print(list(range(n + 1))) +max_ = sum(range(n - k + 1, n + 1)) +min_ = sum(range(k)) -    if n > i: -        max_ = tot[n] - tot[n - i] -    else: -        max_ = tot[n] -    min_ = tot[i - 1] +    # print(max_, min_, cnt) +    # print(cnt) +    if n > i + 1: +        max_ += n - i +    else: +        max_ = sum_ +    min_ += i