if __name__ == "__main__":
    # 1 <= N <= 2 * 10^5
    # 1 <= K <= N + 1
    N, K = map(int, input().split(" "))

    total_num = 0
    for k in range(K, N+2):
        # NからN-(k-1)までの和
        sum_max = k*(2*N - k + 1) / 2
        # 0から(k-1)までの和
        sum_min = k*(k-1) / 2
        # 個数を計上
        total_num += sum_max - sum_min + 1
        total_num %= 1000000007
    
    print(total_num)