#include<bits/stdc++.h>

#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl '\n'

typedef long long int ll;

using namespace std;

const ll N = 2e5 + 77;
ll A[N], Pre[N];
ll n , k ; 

ll f(ll x){
    return max(0LL,(x-1) - 2*(max(0LL,x-n-1)));
}

void sol(){
    cin >> n >> k ;
    ll ans = 0;
    
    for(ll i = k + 2; i <= 2* n ; ++i){
        ans += f(i)*f(i-k);
    }
    cout << ans << endl;
}

int32_t main(){
    fast;
    int t  = 1; 
    // cin >> t;
    while(t--) sol();
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define init(a,i) for(int k=0;k<(i);k++)(a)[k]=0
#define in(a,i) for(int k=0;k<(i);k++)cin>>(a)[k]
#define all(a)  (a).begin(),(a).end()
#define inf 2147483647
#define range(x,a,b) (a)<=x&&x<=(b)
#define mod 998244353
int main(){
	ll n,k;
	cin>>n>>k;
	ll ab=2*n,cd=ab-k;
	ll count=0;
	while(ab>=2){
		if(cd>=2&&cd<=2*n)count+=(min(ab-2,2*n-ab)+1)*(min(cd-2,2*n-cd)+1);
		ab--;
		cd=ab-k;
	}
	cout<<count;
	return 0;
}