local n, y = io.read("*n", "*n")

local result = {-1, -1, -1}
for i = 0, n do
    for j = 0, n - i do
        local k = n - i - j
        if 10000*i + 5000*j + 1000*k == y then
            result[1], result[2], result[3] = i, j, k
        end
    end
end

print(table.concat(result, " "))