#include <stdio.h>

int main(void){
    // Your code here!
    long int n,k;
    scanf("%ld %ld", &n,&k);
    long int a =0;
    for (int i=0;i<n+2-k;i++) {
        a+=((n-(k+i-1))*(k+i))+1;
    }
        printf("%ld",a%1000000007);
    }
