#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)

int main() {
    int n, k;
    cin >> n >> k;
    long long ans = 0;
    for(long long ab = 2; ab <= 2 * n; ++ab) {
        long long cd = ab - k;
        if(cd < 2) continue;
        long long A = ab - 1 - (max(0LL, (ab - 1) - n)) * 2;
        long long C = cd - 1 - (max(0LL, (cd - 1) - n)) * 2;
        if(A <= 0 || C <= 0) continue;
        ans += A * C;
    }
    cout << ans << '\n';
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

inline ll ways(ll c, ll &n)
{
	if (c < 2 || c > 2*n) return 0;
	if (c <= n+1) return c-1;
	return 2*n-c+1;
}

int main()
{
	ll n, k;
	scanf("%lld%lld", &n, &k);
	ll ans = 0;
	for (ll z = 2; z <= 2*n; ++z) {
		ans += ways(z, n)*ways(z+k, n);
	}
	printf("%lld\n", ans);
}