#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, v;
  cin >> n >> v;
  int ans = 0;
  int tank = 0;
  for (int i = 1; i < n; i++) {
    if (tank == 0) {
      ans += min(v, n - 1) * i;
      tank += min(v, n - 1) - 1;
    } else {
      if (tank >= n - i)
        break;
      else
        ans += i;
    }
  }
  cout << ans << "\n";
  return 0;
}
