main :: IO ()
main = do
    line <- getLine
    let n = read (head (splitOn ' ' line)) :: Int
    let y = read (last (splitOn ' ' line)) :: Int
    putStrLn $ showRes $ calc n y

calc :: Int -> Int -> (Int, Int, Int)
calc n y = if length res == 0 then (-1, -1, -1) else snd $ head res
    where
        res = filter (\x -> y == fst x) $ map calcSum [(a, b, n - a - b) | a <- [0..n], b <- [0..(n - a)]]
        calcSum (a, b, c) = (a * 10000 + b * 5000 + c * 1000, (a, b, c))

showRes :: (Int, Int, Int) -> String
showRes (a, b, c) = show a ++ " " ++ show b ++ " " ++ show c

splitOn :: Char -> String -> [String]
splitOn c s
    = current "" [] c $ reverse s
    where
        current :: String -> [String] -> Char -> String -> [String]
        current cur lis c [] = cur:lis
        current cur lis c (x:ss)
            = if c == x then
                  current "" (cur:lis) c ss
              else
                  current (x:cur) lis c ss
