function Main(input) {
  input = input.split(" ");

  var N = ~~input[0];
  var Y = ~~input[1];

  var You = function(N, Y){
    this.howMany = N;
    this.howMuch = Y;
  }

  You.prototype = {
    check: function(){
      for(var howMany10000yen = 0; howMany10000yen <= this.howMany; howMany10000yen++){
        for(var howMany5000yen = 0; howMany5000yen <= this.howMany - howMany10000yen; howMany5000yen++){
          var howMany1000yen = this.howMany - howMany10000yen - howMany5000yen;
          var candidatePrice = howMany1000yen*1000 + howMany5000yen*5000 + howMany10000yen*10000;
          if(candidatePrice == this.howMuch) return String(howMany10000yen)+" "+String(howMany5000yen)+" "+String(howMany1000yen);
        }
      }
      return "-1 -1 -1";
    }
  }

  var you = new You(N, Y);
  console.log(you.check());
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
