program SLR
 implicit none
 integer::N,Y,ishota=0,ishotb=0,ishotc=0,p=0,q=0,r=0
 read(*,*)N,Y
 do ishota=0,N
  do ishotb=0,N-ishota
   do ishotc=0,N-ishota-ishotb
    if(10000*ishota+5000*ishotb+1000*ishotc==Y)then
     p=ishota
     q=ishotb
     r=ishotc
    end if
   end do
  end do
 end do
 if(p==0.and.q==0.and.r==0)then
  print'(i0,a,i0,a,i0)',-1," ",-1," ",-1
 else
  print'(i0,a,i0,a,i0)',p," ",q," ",r
 end if
end program SLR