program main
   implicit none
   INTEGER :: n, x, i, j, k
   READ(*, *) n, x
   do i = 0, n
      do j = 0, n - i
        k = n - i - j
        if(10000 * i + 5000 * j + 1000 * k == x) then
            WRITE(*, *) i, j, k
            goto 100
        endif
        enddo
    enddo 
    WRITE(*, *) -1, -1, -1
    100 end
!end program main