program C085
    implicit none
    integer(8) :: N, Y
    integer(8) :: i, j, k, in, jn, kn, ju

    read(5,*) N, Y

    ju = 0
    do i = 0, N
        do j = 0, N-i
            k = N-i-j
            if (10000*i+5000*j+1000*k == Y) then
                ju = ju + 1
                in = i
                jn = j
                kn = k
            end if
        end do
    end do

    if (ju == 0) then
        write(6,*) "-1 -1 -1"
    else
        write(6,*) in, jn, kn
    end if



    
end program C085