import sys

mod = 7 + 10 ** 9



def solve():

    input = sys.stdin.readline

    N, K = list(map(int, input().split()))

    ans = 0

    for k in range(K, N + 2):

        minSum = (0 + k - 1) * k // 2

        maxSum = (N - k + 1 + N) * k // 2

        ans += (maxSum - minSum + 1) % mod

        ans %= mod

    print(ans)

    





    return 0



if __name__ == "__main__":

    solve()
import sys

mod = 7 + 10 ** 9



def solve():

    input = sys.stdin.readline

    N, K = list(map(int, input().split()))

    ans = 0

    for k in range(K, N + 2):

        minS = (k - 1) * k // 2

        maxS = (N - k + 1 + N) * k // 2

        ans += (maxS - minS + 1)

        ans %= mod



    print(ans) 



    return 0



if __name__ == "__main__":

    solve()
import sys

mod = 7 + 10**9


def solve():
    input = sys.stdin.readline
    N, K = list(map(int, input().split()))
    ans = 0
    for k in range(K, N + 2):
        minSum = (0 + k - 1) * k // 2
        maxSum = (N - k + 1 + N) * k // 2
        ans += (maxSum - minSum + 1) % mod
        ans %= mod
    print(ans)
    return 0


if __name__ == "__main__":
    solve()

import sys

mod = 7 + 10**9


def solve():
    input = sys.stdin.readline
    N, K = list(map(int, input().split()))
    ans = 0
    for k in range(K, N + 2):
        minS = (k - 1) * k // 2
        maxS = (N - k + 1 + N) * k // 2
        ans += maxS - minS + 1
        ans %= mod
    print(ans)
    return 0


if __name__ == "__main__":
    solve()

-        minSum = (0 + k - 1) * k // 2 -        maxSum = (N - k + 1 + N) * k // 2 -        ans += (maxSum - minSum + 1) % mod +        minS = (k - 1) * k // 2 +        maxS = (N - k + 1 + N) * k // 2 +        ans += maxS - minS + 1