implicit none

integer :: n, y
integer :: i, j, k

read *, n, y

y = y / 1000

do i = 0, n
   do j = 0, n-i
      k = n - i - j
      if (i*10 + j*5 + k == y) then
         write(6,'(i0,1x,i0,1x,i0)') i,j,k
         stop
      endif
   enddo
enddo

write(6,'(a)') '-1 -1 -1'
end