main :: IO ()
main = do
  [n,y] <- map read . words <$> getLine :: IO [Int]
  print $ f [show a ++ " " ++ show b ++ " " ++ show c | a <- [0..n],b <- [0..n],c <- [0..n],a + b + c == n,10000* a + 5000 * b + 1000 * c == y]
    where f xs =  if length xs > 0 then head xs else "-1 -1 -1"
