main = map read . words <$> getLine >>= \[n, k] -> print (answer n k)
answer n k = sum
      [case (a == b, b == c, c == a) of 
        (True, True, True)    -> 1
        (False, False, False) -> 6
        _                     -> 3 | 
      ab <- [k, 2 * k .. 2 * n], 
      ca <- [ab, ab + k .. 2 * n], 
      bc <- [ca, ca + k .. 2 * n], 
      let (abc, m) = (ab + bc + ca) `divMod` 2,
      let a = abc - bc, 
      let b = abc - ca, 
      let c = abc - ab,
      m == 0, 0 < a, c <= n]

