process.stdin.resume();
process.stdin.setEncoding('utf-8');

function calcBillSheets(num, yen) {
  var billComb = [num, 0, 0];
  var total;

  while ((total = totalSum(billComb)) !== yen) {
    if (billComb[1] === 0) {
      if (billComb[0] > 0) {
        billComb[1]++; billComb[0]--;
      }
      billComb[1] += billComb[2];
      billComb[2] = 0;
    } else {
      billComb[1]--;
      billComb[2]++;
    }

    if (billComb[2] === num) {
      break;
    }
  }

  if (totalSum(billComb) === yen) {
    return billComb;
  } else {
    return [-1, -1, -1];
  }
}

function totalSum(billComb) {
  return billComb[0] * 10000 + billComb[1] * 5000 + billComb[2] * 1000;
}

process.stdin.on('data', function (line) {
  var arg = line.trim().split(' ');
  console.log(calcBillSheets(parseInt(arg[0]), parseInt(arg[1])).join(' '));
  process.exit(0);
});
