program test
implicit none
integer::N,Y,i,j,check
read(*,*)N,Y
check=0
do i=0,N
	do j=0,N-i
    	if(i*10000+j*5000+(N-i-j)*1000==Y)then
    	print*,i,j,(N-i-j)
    	check=1
    	exit
    	end if
    end do
    if(check==1)exit
end do
if(check==0)then
print*,-1,-1,-1
end if
end program