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

#define M 1000000007

int main( int argc, char *argv[] )
{
    long long n, k;
    long long t = 0;
    long long min, max;

    scanf( "%lld %lld", &n, &k );

    for( int i=k; i<=n+1; i++ ) {

        min = (long long)(i-1)*i/2;
        max = (n+n-i+1)*i/2;
//        for( int j=0; j<i; j++ ) {
//            min += j;
//            max += n-j;
//        }
//printf( "%lld %lld \n", min, max );
        t += (max - min + 1) % M;
        t = t % M;
    }

    printf( "%lld\n", t );
}
