#include <bits/stdc++.h>
int main(void) {
  int N = 0, X = 0;
  int ans = 0, i = 0;
  scanf("%d%d", &N, &X);
  ans += N - X;
  for (i = 1; i < N - X; i++) ans += i * (N - X);
  printf("%d\n", ans);
  return 0;
}
