program main
  integer flag, n, y
  flag = 0
  read *, n, y
  do i=0, n
     do j=0,n
        if(i+j<=n .and. 1000*i + 5000*j + 10000*(n-i-j)==y ) then
           print '(i5 i5 i5)', i, j, n-i-j
           stop
        end if
     end do
  end do
  print '(a)', "-1 -1 -1"
  stop
end program main
