#include<stdio.h>
#include <math.h>

int combination(int n, int r)
{
    int tmp=r;
    if(r==0 || r==n){
        return 1;
    }else if(r==1){
        return n;
    }else if(r>n){
        return 0;
    }else{
        for(int i=r-1;i>=1;i--){
            r*=i;
            n*=n-(tmp-i);
        }
        return n/r;
    }
}


int main(void){
    long n,k,tmp=0,max,min;
    scanf("%ld %ld",&n,&k);
    for(long i=k;i<=n+1;i++){
        min=0;
        for(long ii=0;ii<=i-1;ii++){
            min+=ii;
        }
        max=0;
        for(long ia=n;ia>=n-(i-1);ia--){
            max+=ia;
        }
        tmp+=max-min+1;
    }
    printf("%ld",tmp);
    return 0;
}