main :: IO ()
main = do
    [count, amount] <- map read . words <$> getLine
    let cases = execOtoshidama count amount
    let (x, y, z) = head cases
    if not (null cases)
        then putStrLn $ mconcat [show x," ",show y," ", show z] 
        else putStrLn "-1 -1 -1"
        
execOtoshidama :: Int -> Int -> [(Int, Int, Int)]
execOtoshidama num amount =
        let abc = [(a, b, c) | a <- [0 .. num], b <- [0 .. num], c <- [0 .. num], a + b + c == num]
        in  filter (\(a, b, c) ->
                a * 1000 + b * 5000 + c * 10000 == amount
            ) abc