#include <bits/stdc++.h>
using namespace std;
int n, v;
int main() {
  cin >> n >> v;
  int ans = 0;
  int p = 1;
  int cur = 0;
  for (int i = n - 1; i >= 0; i--, p++) {
    if (cur >= i) continue;
    ans += p * (min(i, v - cur));
    cur = cur + min(i, v - cur) - 1;
  }
  cout << ans << endl;
  return 0;
}
