/** * @FileName a.cpp * @Author kanpurin * @Created 2020.06.13 16:38:54 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { ll n,k;cin >> n >> k; cout << k * (2 * n - k + 1) / 2 - k % 2 + 1 << endl; return 0; }