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

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