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


int main(){

    int N, K;
    scanf("%d %d", &N, &K);

    int i, j, fi, la;
    long int answer = 0;

    for(i = K; i <= N+1; i++){
        fi = 0;
        la = 0;
        for(j = 0; j <= i-1; j++){
            fi += j;
        }
        for(j = N; j >= N-i+1; j--){
            la += j;
        }
        answer += la-fi+1;
    }
    printf("%ld\n",answer);
    printf("%ld",answer%1000000007);

   return 0;
}