main :: IO ()
main = do
    [n,y] <- map read . words <$> getLine
    let (c,d,e) = reidasuyo y (pittan01 n)
    putStrLn $ (show c++" "++ show d ++ " " ++ show e)

pittan01 :: Int -> [(Int, Int, Int)]
pittan01 n = pikosan (0,0,n)

pikosan :: (Int,Int,Int) -> [(Int,Int,Int)]
pikosan (a,b,c) =   if b==0 && c==0 then [(a,b,c)]
                    else if c > 0  then [(a,b,c)] ++ pikosan (a,b+1,c-1)
                    else [(a,b,c)] ++ pikosan(a+1,0,b+c-1)

kingaku :: (Int,Int,Int) -> Int
kingaku (a,b,c) = 10000*a+5000*b+1000*c

reidasuyo :: Int -> [(Int,Int,Int)] -> (Int,Int,Int)
reidasuyo y xs =    if filter ((== y).kingaku) xs == [] then (-1,-1,-1)
                    else head(filter ((== y).kingaku) xs)