process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {

    var ny = input[0].split(' ');
    var n = parseInt(ny[0], 10);
    var y = parseInt(ny[1], 10);


    var a = -1;
    var b = -1;
    var c = -1;

    for (var i = 0; i <= n; i++) {

        if (((y / 1000) - n - 4 * i) % 9 === 0) {
            a = ((y / 1000) - n - 4 * i) / 9;
            b = i;
            c = n - a - b;
            if (a < 0 || b < 0 || c < 0) {
                a = -1;
                b = -1;
                c = -1;
            }
            else {
                break;
            }
        }
    }

    console.log(a + ' ' + b + ' ' + c);

    return 0;
}
