'use strict'

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

  const result = [-1, -1, -1]

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