#include <bits/stdc++.h>

using namespace std;

//@formatter:off

//@formatter:on

int main() {
    int N, K;
    cin >> N >> K;
    int64_t res = 0;
    for (int A = 2; A <= 2 * N; A++) {
        int B = A - K;
        if (!(2 <= B and B <= 2 * N)) continue;
        int64_t pa = 0, pb = 0;
        if (A <= N )pa += A - 1;
        else pa += 2 * N - A + 1;
        if (B <= N ) pb += B - 1;
        else pb += 2 * N - B + 1;
        res += pa * pb;
    }
    cout << res << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define ARRAY_LENGTH(array) sizeof(array)/sizeof(*array)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int INF = 1000100100;

int main() {
    ll A, B;
    cin >> A >> B;
    ll X, Y;
    X = (A + B)/2;
    Y = A - X;
    cout << X << " " << Y << endl;

    return 0;
}