#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

void load(void);
void calc(void);
void output(void);

long long N, K, countt;

int main(){
	load();
	calc();
	output();
	return 0;
}

void load(void){
	cin >> N >> K;
}

void calc(void){
	countt = (N+1)*(((N+2)*5*N/6) + 1) - K*(K-1)*(N/2 + 5/6 - K/3) - K + 1;
}

void output(void){
	cout << countt;
}