main :: IO ()
main = do
    [n,yen] <- readInts
    putStrLn $ solve n yen

readInts :: IO [Int]
readInts = map read . words <$> getLine

solve :: Int -> Int -> String
solve n = format . find n

format :: (Int,Int,Int) -> String
format = unwords . map show . toList
  where
    toList (x,y,z) = [x,y,z]

find :: Int -> Int -> (Int,Int,Int)
find n yen
  | null xyzs = (-1,-1,-1)
  | otherwise = head xyzs
  where
    xyzs = numBills n yen

numBills :: Int -> Int -> [(Int,Int,Int)]
numBills n yen = [(x,y,z) | x <- [0..n]
                          , y <- [0..n-x]
                          , let z = n-x-y
                          , amount x y z == yen]

amount :: Int -> Int -> Int -> Int
amount x y z = 10000 * x + 5000 * y + 1000 * z
