#include <bits/stdc++.h>
using namespace std;
long long n, v;
void solve() {
  cin >> n >> v;
  long long ans = 0, c = 0, x = 1;
  while (x < n) {
    if (c < n - x) {
      ans += x * min(v - c, n - x - c);
      c += min(v - c, n - x - c);
    }
    c--;
    x++;
  }
  cout << ans << endl;
}
void prep() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  prep();
  cout << fixed << setprecision(12);
  while (t--) solve();
  return 0;
}
