implicit none
integer(8):: n,y,i,j
 
read(5,*) n,y
 
do i=0,n
    do j=0,n-i
    if (10000*i+5000*j+1000*(n-i-j)==y) then
        write(6,*) i,j,n-i-j
        goto 100
 endif
 
 enddo
enddo
 
 write(6,*) -1,-1,-1
 
100 end