#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, v;
  cin >> n >> v;
  long long cur, ans;
  if (n - 1 < v) {
    cur = n - 1;
    ans = n - 1;
  } else {
    cur = v;
    ans = v;
  }
  cur--;
  for (long long i = 2; i < n; i++) {
    if (cur >= n - i) break;
    if (n - i < v) {
      ans += i * (n - i - cur);
      cur = n - i;
    } else {
      ans += i * (v - cur);
      cur = v;
    }
    cur--;
  }
  cout << ans;
  return 0;
}
