"use strict";

function Main(input) {
  input = input.split(" ");
  input[0] = parseInt(input[0]);
  input[1] = parseInt(input[1]);
  let num = input[1]; // 計算用

  let counter = [0, 0, 0];

  // console.log(input[1] / 1000);
  // console.log(input[1] / 5000);

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

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