'use strict'

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

  /*
  const maxX // 10000円札の最大枚数
  const maxY // 5000円札の最大枚数
  const maxZ // 1000円札の最大枚数
  */
  const result = [-1, -1, -1]

  for (let i=0; i<=numOfBills; i++) {
    for (let j=0; j<=numOfBills-i; 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)
}

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