#include <bits/stdc++.h>
using namespace std;
const int mod7 = (int)1e9 + 7;
const int mod9 = (int)1e9 + 9;
const long long inf = 1e18 + 100;
const int INF = 1000000000;
const int N = 1e6 + 100;
const long double EPS = 1e-9;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  long long ans = 0, last = 0;
  for (int i = m + 1; i <= (n + 1) / 2; i++) {
    long long cnt = 0;
    for (int j = m + 1; j <= n - m; j++) {
      int t = ((2 * i - j) * (n + 1 - i) - 1) / (i + j);
      t = min(t, n - m);
      if (t <= m) break;
      cnt += t - m;
    }
    ans += cnt;
    last = cnt;
  }
  ans *= 2;
  if (n % 2) ans -= last;
  cout << ans * 3;
  return 0;
}
