#include <stdio.h>
int main()
{
    long long int n, k, i, count = 0, min, sumn, max;
    scanf("%lld %lld", &n, &k);
    sumn = n * (n + 1) / 2;
    for(i = k; i <= n + 1; i++)
    {
        min = i * (i - 1) / 2;
        max = sumn - (n - i) * (n - i + 1) / 2;
        count += (max - min + 1) % 1000000007;
        count = count % 1000000007;
    }
    printf("%lld", count);
    return 0;
}
