#include <stdio.h>
#include <stdlib.h>

int main()
{
        long i, N,K;
        long sum = 0L;
        scanf("%ld %ld", &N, &K);
        long den = 1000000007L;
        for (i=K;i<=N+1;i++) {
                sum += (i*(N-i+1)+1);
        }
        printf("%ld\n", sum%den);
        return EXIT_SUCCESS;
}