#include <bits/stdc++.h>
using namespace std;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
int n, v;
cin >> n >> v;
if (n-1 <= v) {
cout << n-1 << endl;
return 0;
}
int result = v - 1;
for(int i = 1; i <= n - v; ++i) {
result += i;
}
cout << result << endl;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgoKaW50MzJfdCBtYWluKCkgewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7CiAgICBjaW4udGllKG51bGxwdHIpLCBjb3V0LnRpZShudWxscHRyKTsKICAgIAogICAgaW50IG4sIHY7CiAgICBjaW4gPj4gbiA+PiB2OwogICAgaWYgKG4tMSA8PSB2KSB7CiAgICAgICAgY291dCA8PCBuLTEgPDwgZW5kbDsKICAgICAgICByZXR1cm4gMDsKICAgIH0KICAgIGludCByZXN1bHQgPSB2IC0gMTsKICAgIGZvcihpbnQgaSA9IDE7IGkgPD0gbiAtIHY7ICsraSkgewogICAgICAgIHJlc3VsdCArPSBpOwogICAgfQogICAgY291dCA8PCByZXN1bHQgPDwgZW5kbDsKCiAgICByZXR1cm4gMDsKfQo=