"use strict";

function Main(input) {
  input = input.split(" ");
  input[0] = parseInt(input[0]);
  input[1] = parseInt(input[1]);

  let counter = [0, 0, 0];

  while (input[1] >= 10000) {
    if (counter[0] + counter[1] + counter[2] === input[0]) break;
    input[1] = input[1] - 10000;
    counter[0]++;
  }
  while (input[1] >= 5000) {
    if (counter[0] + counter[1] + counter[2] === input[0]) break;
    input[1] = input[1] - 5000;
    counter[1]++;
  }
  while (input[1] >= 1000) {
    if (counter[0] + counter[1] + counter[2] === input[0]) break;
    input[1] = input[1] - 1000;
    counter[2]++;
  }
  // console.log(input[1]);
  // console.log(counter);
  if (input[1] === 0) {
    console.log(counter[0], counter[1], counter[2]);
  } else {
    console.log(-1, -1, -1);
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf-8"));
