#include <stdio.h>
long calcmin(long N, long M)
{
    return M * (M - 1) / 2;
}
long calcmax(long N, long M)
{
    return M * (2 * N - M + 1) / 2;
}
int main(void)
{
    int N, K;
    long sums = 0;
    scanf("%i %i", &N, &K);
    for (long M = K; M <= N + 1; M++)
    {
        sums += calcmax(N, M) - calcmin(N, M) + 1;
    }
    printf("%ld\n", sums % 1000000007);

    return 0;
}