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