#include <bits/stdc++.h>

#define INF 1000000007
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i < b; i++)

using namespace std; 

typedef long long ll;
typedef long long int  lli;
typedef long double ld;
typedef vector<int> vi;
typedef unordered_map<int,int> umi ;
typedef unordered_set<int> usi ;
typedef pair<int,int> pi;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif


 
 
//declare here -------------------------------------------------------------------------------
const int N =1e5 ;
ll numways[2*N +1 ] ;
ll n , k ;
void gen(){
    REP(i,2,n+2){
        numways[i]=numways[i-1]+1 ;
    }
    REP(i,n+2 , 2*n +1) numways[i]=numways[i-1]-1 ;
}


// solve here ---------------------------------------------------------------------------------
void solve(){
   cin>>n>>k ;
   gen() ;
   ll ans=0 ;
   REP(B ,2 , 2*n +1 ){
    int A =k+B ;
    if(A<2 || A>2*n ) continue ;
    ans+=numways[A]*numways[B] ;
   }
   cout<<ans ;
}


 


//--------------------------------------------------------------------------------------------





int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long test =1 ;
    //cin>>test ;
    while(test--){
        debug(test) ;
        solve() ;
        cout<<"\n" ;
    }
    return 0 ;
}
#include<bits/stdc++.h>
using ll = int_fast64_t;
#define REP(i,b,e) for(ll i=b; i<e; i++)

int main(){
	ll n, k;
	scanf("%ld %ld", &n, &k);

	ll ans = 0;
	REP(i, 2, 2*n+1){
		if(i-k < 2) continue;
		ll j = i-k;
		if(i > 2*n || j > 2*n) continue;
		ll tmp = 1;
		if(i < n+2) tmp *= i-1;
		else tmp *= i - 1 - 2*(i-n-1);
		if(j < n+2) tmp *= j-1;
		else tmp *= j - 1 - 2*(j-n-1);
		ans += tmp;
	}
	printf("%ld\n", ans);
	return 0;
}

