main :: IO ()
main = do
  [n,y] <- map read . words <$> getLine :: IO [Int]
  print $ head [show a ++ " " ++ show b ++ " " ++ show c| a <- [0..n],b <- [0..n],c <- [0..n],a + b + c == n,10000* a + 5000 * b + 1000 * c == y]