program main
implicit none
integer :: i, j, k
integer :: n, y

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

end program main
