{-# LANGUAGE ScopedTypeVariables #-}
import qualified Data.ByteString.Char8 as BS

main = do
  [n,y] :: [Int] <- map (read . BS.unpack) . BS.words <$> BS.getLine
  let result = [ (man,gosen,sen)
               | let maxMan = min n (y `quot` 10000)
               , man <- [maxMan, maxMan - 1 .. 0]
               , let maxGosen = min (n-man) ((y - 10000*man) `quot` 5000)
               , gosen <- [maxGosen, maxGosen - 1 .. 0]
               , let sen = n - man - gosen
               , sen >= 0
               , (y - 10000*man - 5000*gosen) == 1000 * sen
               ]
  putStrLn $ unwords $ map show $ case result of
    (man,gosen,sen):_ -> [man,gosen,sen]
    [] -> [-1,-1,-1]
