#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll=long long;

int main() {
	int n,k;
	cin>>n>>k;
	
	ll ans=0;
	for(int i=k;i<=n+1;i++){
		ll max,min;
		max=(2*n+1-i)*i/2;
		min=(i-1)*i/2;
		ans+=max-min+1;
	}
	
	cout<<ans<<endl;
}
