#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
int n, m;
inline int calc(int A, int B, int C, int low, int high) {
  int ret = 0;
  int res = B / (C - low);
  for (int i = low; i <= high; ++i) {
    while ((C - i) * (res + 1) <= B) ++res;
    ret += A + res;
  }
  return ret;
}
int main() {
  cin >> n >> m;
  long long ans = 0, center = 0;
  for (int i = m + 1; i <= n - i + 1; ++i) {
    int A = i - (n + 1);
    int B = (3 * i * (n + 1 - i) - 1);
    int C = i + n + 1;
    int low = m + 1, high = n - m;
    if (low > high) continue;
    while (low < high) {
      int mid = ((low + high) >> 1);
      if (A + B / (C - mid) >= m + 1) {
        high = mid;
      } else {
        low = mid + 1;
      }
    }
    if (i == n - i + 1) center = ans;
    if (A + B / (C - low) <= m) continue;
    int upperBound = low;
    low = upperBound;
    high = n - m;
    while (low < high) {
      int mid = ((low + high) >> 1) + 1;
      if (A + B / (C - mid) <= n - m) {
        low = mid;
      } else {
        high = mid - 1;
      }
    }
    if (A + B / (C - low) > n - m) {
      ans += (n - m - upperBound + 1) * (n - 2 * m);
      continue;
    }
    ans += (n - m - low) * (n - 2 * m);
    ans += calc(A, B, C, upperBound, low) - m * (low - upperBound + 1);
  }
  if (n % 2 == 1) {
    ans = center * 6 + (ans - center) * 3;
  } else {
    ans *= 6;
  }
  cout << ans << endl;
  return 0;
}
