    #include <stdio.h>

    int main()      /*this code is written by 190042146*/
{
    long long int n ,k, tally=0;
    scanf("%lld%lld", &n, &k);

    if (k>n)
    {
        printf("1");
    }

    else
    {
        for (;k<=n+1;k++)
        {
            tally=tally+ k*n-(k-1)*k+1;
        }

        printf("%d",tally%(1000000000+7));
    }

    return 0;
}




