implicit none
integer(8):: n,y,i,j,count

read(5,*) n,y
count=0

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
        count=1
        goto 100
    endif
    
    enddo
enddo

if (count==0) then
    write(6,*) -1,-1,-1
endif

100 end
