

solve :: Int -> Int ->[(Int,Int,Int)]
solve n yen =
   [(x,y,n-x-y)| x<-[0..n], y<-[0..n-x], x*10000+y*5000+(n-x-y)*1000==yen]
  
main = do
  [n, yen] <- map read . words <$> getLine :: IO [Int]
  let anss = solve n yen 
  print $ if null anss then (-1,-1,-1) else head anss


