import Control.Monad

main = map read . words <$> getLine >>= \[n, k] -> print (answer n k)
answer n k = 
  6 * length ([k, 2 * k .. 2 * n] >>= \ab -> 
    [ab + k, ab + 2 * k .. 2 * n] >>= \ca ->
    [ca + k, ca + 2 * k .. 2 * n] >>= \bc ->
    let (abc, m) = (ab + bc + ca) `divMod` 2 in
    guard (m == 0 && 0 < abc - bc && abc - ab <= n)) +
  3 * length ([k, 2 * k .. 2 * n] >>= \ab -> 
    [ab + k, ab + 2 * k .. 2 * n] >>= \ca ->
    let (abc, m) = (ab + ab + ca) `divMod` 2 in
    guard (m == 0 && 0 < abc - ca && abc - ab <= n)) +
  3 * length ([k, 2 * k .. 2 * n] >>= \ab -> 
    [ab + k, ab + 2 * k .. 2 * n] >>= \ca ->
    let (abc, m) = (ab + ca + ca) `divMod` 2 in
    guard (m == 0 && 0 < abc - ca && abc - ab <= n)) +
  length ([k, 2 * k .. 2 * n] >>= \ab -> 
    let (abc, m) = (3 * ab) `divMod` 2 in
    guard (m == 0 && 0 < abc - ab && abc - ab <= n)) 

