{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ n, yen ] <- readInts
	let
		candidate = [ ( i, j, n - i - j ) | i <- [ 0 .. 2000 ], j <- [ 0 .. 2000 ],
			i + j <= n,
			yen - 10000 * i - 5000 * j == 1000 * ( n - i - j ) ]
		( i, j, k ) = which ( head candidate ) ( -1, -1, -1 ) $ 0 < length candidate
	printf "%d %d %d\n" i j k
