#n=int(input())

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

#l=list(map(int,input().split()))

#l=[list(map(int,input().split())) for i in range(n)]



mod=10**9+7

ans=0

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

    mx=kval*(2*n-kval+1)//2

    mn=kval*(kval-1)//2

    add=mx-mn+1

    ans=(ans+add) % mod



print(ans)



#l=int(input())

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

#pl=list(map(int,input().split()))

#l=[list(map(int,input().split())) for i in range(n)]



mod=10**9+7

total=0



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

    add=m*(n-m+1)+1

    total=(total+add)%mod

print(total)







# n=int(input())
n, k = list(map(int, input().split()))
# l=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
mod = 10**9 + 7
ans = 0
for kval in range(k, n + 2):
    mx = kval * (2 * n - kval + 1) // 2
    mn = kval * (kval - 1) // 2
    add = mx - mn + 1
    ans = (ans + add) % mod
print(ans)

# l=int(input())
n, k = list(map(int, input().split()))
# pl=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
mod = 10**9 + 7
total = 0
for m in range(k, n + 2):
    add = m * (n - m + 1) + 1
    total = (total + add) % mod
print(total)

-# n=int(input()) +# l=int(input()) -# l=list(map(int,input().split())) +# pl=list(map(int,input().split())) -ans = 0 -for kval in range(k, n + 2): -    mx = kval * (2 * n - kval + 1) // 2 -    mn = kval * (kval - 1) // 2 -    add = mx - mn + 1 -    ans = (ans + add) % mod -print(ans) +total = 0 +for m in range(k, n + 2): +    add = m * (n - m + 1) + 1 +    total = (total + add) % mod +print(total)