{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}

main :: IO ()
main = putStrLn . showResult =<< solve <$> getInput

showResult :: Maybe (Int, Int, Int) -> String
showResult Nothing          = "-1 -1 -1"
showResult (Just (a, b, c)) = show a ++ " " ++ show b ++ " " ++ show c

getInput :: IO (Int, Int)
getInput = do
  [n, y] <- map read . words <$> getLine
  return (n, y)

solve :: (Int, Int) -> Maybe (Int, Int, Int)
solve (n, y) = headMaybe [(x, y, z)
                         | x <- [0 .. n]
                         , y <- [0 .. n]
                         , z <- [0 .. n]
                         , x + y + z == n
                         , 10000 * x + 5000 * y + 1000 + z == y
                          ]

headMaybe :: [a] -> Maybe a
headMaybe []     = Nothing
headMaybe (x:xs) = Just x
