{-# LANGUAGE BangPatterns #-}

module Main where

import Control.Applicative
import Control.Monad
import Data.List
import Data.Maybe
import Text.Printf

check :: Int -> (Int, Int, Int) -> Maybe (Int, Int, Int)
check n (p, q, r) = iter (p, q, r)
  where
    iter :: (Int, Int, Int) -> Maybe (Int, Int, Int)
    iter (!a, !b, !c)
        | a < 0 || b < 0 = Nothing
        | k >  n         = Nothing
        | k == n         = Just (a, b, c)
        | otherwise      =
            iter (a - 1, b + 2, c) <|> iter (a, b - 1, c + 5)
      where
        k = a + b + c

main :: IO ()
main = do
    [n, y] <- fmap read . words <$> getLine :: IO [Int]
    let (q1, r1) = y  `divMod` 10000
    let (q2, r2) = r1 `divMod` 5000
    let (q3, r3) = r2 `divMod` 1000
    let ans = check n (q1, q2, q3)
    case ans of
        Nothing        -> putStrLn "-1 -1 -1"
        Just (a, b, c) -> printf "%d %d %d\n" a b c