program main
	integer N, Y
	read(*, *) N, Y
	do i = 0, N
		do j = 0, N-i
			if(Y == 1000*i + 5000*j + 10000*(N-i-j)) then
				write(*, *) N-i-j, j, i
				goto 1
			end if
		end do
	end do
1 continue
	if(Y /= 1000*i + 5000*j + 10000*(N-i-j)) then
		write(*, *) -1, -1, -1
	end if
end program main