import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust, isNothing )

cReadLn :: IO Int
cReadLn = fst . fromJust . C.readInt <$> C.getLine

getParms :: IO [Int]
getParms = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  [n,y] <- getParms
  putStrLn $ f n y

type Pochi = (Int,Int,Int) -- 10000, 5000, 1000
type Mai = Int
type Yen = Int

gok :: Pochi -> Mai
gok (a,b,c) = 10000*a + 5000*b + 1000*c

pInit :: Mai-> Pochi
pInit n = (n,0,0) -- highest

attempt :: Mai -> Yen -> Maybe Pochi
attempt n y = h (pInit n)
  where
    h :: Pochi -> Maybe Pochi
    h p
      | gok p == y = Just p
      | gok p >  y = h (pNext p)
      | gok p <  y = Nothing

    pNext :: Pochi -> Pochi -- Partial function
    pNext (a,b,c)
     | b>0 = (a,b-1,c+1)
     | a>0 = (a-1,b+1,c)

f :: Mai -> Yen -> String
f n y
  | isNothing att = "-1 -1 -1"
  | otherwise     = show a ++ " " ++ show b ++ " " ++ show c
  where
    att = attempt n y
    Just (a,b,c) = attempt n y