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