#include<stdio.h>
int main(void){
  int nNum;
  int chosenNum;
  int count = 0;
  int i;
  int indpNum[nNum - chosenNum];
  int fase = chosenNum;
  int min[200000];
  int max[200000];
  int sum;
  
  
  
  scanf("%d %d",&nNum,&chosenNum);
  
  
  
  for(fase=chosenNum;fase< ;fase++){
  
    min[fase] = 0+1+2;
  
    max[fase] = 1+2+3;
  
  indpNum[fase] = max[fase] - min[fase] +1 ;
  }
  
  for(fase=chosenNum;fase< ;fase++){
    sum += indpNum[fase];
  }
  
  
  printf("%d",sum);

}