'use strict'

function Main(input) {
  const inputList = input.split(' ');
  const numOfBills = Number(inputList[0])
  const moneyTotal = Number(inputList[1])

  const result = [-1, -1, -1]
  const maxX = Math.max(numOfBills, Math.floor(moneyTotal/10000))

  for (let i=maxX; i>=0; i--) {
    const maxY = Math.max(numOfBills-i, Math.floor(moneyTotal/5000))
    for (let j=0; j<=maxY; j++) {
      const k = numOfBills - j - i
      const tmpTotal = 10000 * i + 5000 * j + 1000 * k;
      if (tmpTotal === moneyTotal) {
        result[0] = i
        result[1] = j 
        result[2] = k
        break
      }
      
    }
  }

  console.log(result[0])
  console.log(result[1])
  console.log(result[2])
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));