#include<stdio.h>

int main(){
        long n, k, i, res=0, fir, sec, add;
        scanf("%ld %ld", &n, &k);

        for(i=k; i<=n+1; i++){
                fir=i*(2*n-i+1)/2;
                sec=i*(i-1)/2;
                add=fir-sec+1;
                res=(res+add)%1000000007;
        }

        printf("%ld", res);

        return 0;
}