void main() {
    int[] tmp = readln.split.to!(int[]);
    int n = tmp[0], y = tmp[1];

    int yukichi = -1, ichiyou = -1, hideyo = -1;

    foreach (i; 0 .. n+1) {
        foreach (j; 0 .. n-i+1) {
            int k = n - i - j;
            if (10000 * i + 5000 * j + 1000 * k == y) {
                yukichi = i;
                ichiyou = j;
                hideyo = k;
                break;
            }
        }
    }

    writeln(yukichi, " ", ichiyou, " ", hideyo);
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;