#include <bits/stdc++.h>
using namespace std;
const long long Inf = 1e9 + 7;
void solve() {
  int64_t n, c;
  cin >> n >> c;
  if (c > (n - 1)) {
    c = n - 1;
  }
  int64_t co = c;
  for (int64_t i = 2; i <= n - c; i++) {
    co += i;
  }
  cout << co << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  cout.precision(10);
  cout << fixed;
  ;
  solve();
  return 0;
}
