{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import qualified Data.ByteString.Char8 as BS
import           Data.Maybe            (fromJust, listToMaybe)

main :: IO ()
main = do
  [n, y] <- map readInt . BS.words <$> BS.getLine
  putStrLn . maybe "-1 -1 -1" (unwords . map show) $ solve n y

solve :: Int -> Int -> Maybe [Int]
solve n y = listToMaybe [[a, b, c]
                        | a <- [0 .. n]
                        , b <- [0 .. n - a]
                        , let c = n - a - b
                        , 10000 * a + 5000 * b + 1000 * c == y]

readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt
