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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll n,k;
  cin >> n >> k;
  k = abs(k);
  ll ans = 0;
  for(ll ab = k+2; ab<=2*n;ab++){
    ll abc, cdc;
    if(ab-1 < n){
      abc = ab-1;
    }
    else{
      abc = 2*n-ab +1;
    }
    ll cd = ab-k;
    if(cd-1 < n){
      cdc = cd-1;
    }
    else{
      cdc = 2*n-cd +1;
    }
    ans += abc*cdc;
    // cout << ans << endl;
  }
  cout << ans << endl;
  return 0;
    

}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; i++)
#define rrep(i,a,b) for (int i = a - 1; i >= b; i--)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ll long long
#define out(x) std::cout << fixed << setprecision(15) << x << '\n'; return 0
#define INT(...) int __VA_ARGS__; in(__VA_ARGS__)
#define LL(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__; in(__VA_ARGS__)
#define VEC(t,a,s) vector<t>a(s); in(a)
#define VEC2(t,a,b,s) vector<t>a(s),b(s);rep(i,0,s)in(a[i],b[i])
#define VEC3(t,a,b,c,s) vector<t>a(s),b(s),c(s);rep(i,0,s)in(a[i],b[i],c[i])
#define VEC4(t,a,b,c,d,s) vector<t>a(s),b(s),c(s),d(s);rep(i,0,s) in(a[i],b[i],c[i],d[i]) 
void scan(int& x) {std::cin >> x;}
void scan(ll& x) {std::cin >> x;}
void scan(double& x) {std::cin >> x;}
void scan(std::vector<int>& x) {rep (i, 0, x.size()) std::cin >> x[i];}
void scan(std::vector<ll>& x) {rep (i, 0, x.size()) std::cin >> x[i];}
void in(){}
template<class T> void print(const T& x) {std::cout << x << '\n';}
template<class Head, class... Tail>
void in(Head& head, Tail&... tail) {scan(head); in(tail...);}
template<class T, class U>
bool chmax(T& a, U b) {if(a < b){a=b; return true;} return false;}
template<class T, class U>
bool chmin(T& a, U b) {if(a > b){a=b; return true;} return false;}
using namespace std;


int main() {
    LL(N, K);

    auto cnt = [&](int x) {
        if (x < 2) return 0;
        if (N < x / 2) return 0;
        int ret = ((x / 2) - max(1LL, (x - N)) + 1) * 2 - (x % 2 == 0);
        return ret;
    };

    ll ans = 0;
    rep (r, 2, 500000) {
        int l = r + K;
        ans += (ll)cnt(l) * cnt(r);
    }

    out(ans);
}