// inputに入力データ全体が入る
function Main(input) {
  input = input.split(" ");
  var maisu = parseInt(input[0]);
  var sum = parseInt(input[1]);
  var returnFlag = false;
  
  var senCount = 0;
  var gosenCount = 0;
  var manCount = 0;
  
  //合計金額から考えられる最大枚数
  var maxSenCount = parseInt(sum / 1000);
  if(maxSenCount > 2000){
     maxSenCount = 2000;
     }
  var maxGosenCount = parseInt(sum / 5000);
  if(maxGosenCount > 2000){
     maxGosenCount = 2000;
     }
  var maxManCount = parseInt(sum / 10000);
  
  if(maxManCount == maisu && maxManCount * 10000 == sum){
    manCount = maxManCount;
    returnFlag = true;
  }
  if(maxGosenCount == maisu && maxGosenCount * 5000 == sum){
    gosenCount = maxGosenCount;
    returnFlag = true;
  }
  if(maxSenCount == maisu && maxSenCount * 1000 == sum){
    senCount = maxSenCount;
    returnFlag = true;
  }
  
  if(!returnFlag){
  for(var i = 0; i <= maxManCount; i++){
    var tmpSum1 = 10000 * i;
    if(tmpSum1 > sum){
    	break;
    }
    for(var j = 0; j <= maxGosenCount - i; j++){
      var tmpSum2 = 10000 * i + 5000 * j;
   	  if(tmpSum2 > sum){
    	break;
      }
      for(var k = 0; k <= maxSenCount - i - j; k++){
        var tmpSum3 = 10000 * i + 5000 * j + 1000 * k;
        if(10000 * i + 5000 * j + 1000 * (maxSenCount - i - j) < sum){
           break;
           }
        if(tmpSum3 > sum){
           break;
           }
        if(tmpSum3 == sum && (i + j + k) == maisu){
           senCount = k;
           gosenCount = j;
           manCount = i;
           }
      }
    }
  }
}
  if(senCount == 0 && gosenCount == 0 && manCount == 0){
     console.log("-1 -1 -1");
  }else{
     console.log(manCount + " " + gosenCount + " " + senCount);
  }
  
  
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
