#include <iostream>

using int64 = long long;

int main()
{    
    int64 n, d;
    std::cin >> n >> d; n--;
    
    int64 N = n - d + 1;
    std::cout << (d == 1 ? n * (n + 1) / 2 : d + (N + 3) * N / 2 - 2) << std::endl;
    return 0;
}