main = map read . words <$> getLine >>= \[n, k] -> print (answer n k)
answer n k = length [(a, b, c) | 
      ab <- [k, 2 * k .. 2 * n], 
      bc <- [k, 2 * k .. min n ab + n], 
      ca <- [k, 2 * k .. min n (min ab bc) + n], 
      let (abc, m) = (ab + bc + ca) `divMod` 2,
      let a = abc - bc, 
      let b = abc - ca, 
      let c = abc - ab,
      let range x = 0 < x && x <= n,
      m == 0, a * b * c /= 0, range a, range b, range c]
