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