import           Control.Monad
import qualified Data.ByteString.Char8 as BS
import           Data.Maybe

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
  [n, y] <- getIntList

  let u = y `div` 10000
      v = y `mod` 10000 `div` 5000
      w = (y - u*10000 - v*5000) `div` 1000

      solve a b c | a+b+c == n   = (a, b, c)
                  | a+b+c <= n-9 = if a > 0
                                   then solve (a-1) b (c+10)
                                   else (-1, -1, -1)
                  | a+b+c <= n-5 = if a > 0
                                   then solve (a-1) (b+1) (c+5)
                                   else (-1, -1, -1)
                  | a+b+c <= n-4 = if b > 0
                                   then solve a (b-1) (c+5)
                                   else (-1, -1, -1)
                  | otherwise    = if a > 0
                                   then solve (a-1) (b+2) c
                                   else (-1, -1, -1)

  putStrLn $ case solve u v w of
    (a, b, c) -> show a ++ " " ++ show b ++ " " ++ show c