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

for i=1,n do
    for j=1,n do
        x=y-1000*i+5000*j
        k=(x%10000==0 and x//10000 or n)
        if i+j+k==n then
            print(i,j,k)
            return
        end
    end
end
print(-1,-1,-1)