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

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