program name
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,i,j,k,y

    read*, n,y

    do i=0,n
        do j=0,n-i
            k = n-i-j
            if (10000*i+5000*j+1000*k == y) then
                print'(3(i0,1x))', i,j,k
                stop
            end if
        end do
    end do

    print'(3(i0,1x))', -1,-1,-1
end program name