#include <stdio.h>
#include <stdlib.h>
int main(){
  int n,k;
  int i;
  int min=0;
  int max=0;
  int answer=0;
  scanf("%d%d",&n,&k);
  for(i=0;i<k;i++){
    max+=n-i;
    min+=i;
  }
  for(i=k;i<=n+1;i++){
    answer+=max-min+1;
    min+=i;
    if(i!=n+1)max+=1;
  }
  printf("%d",answer);
  return 0;
}
