import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int Y = sc.nextInt();
   boolean yen =false;
   int z =0;
 
   int ansx=-1;
   int ansy=-1;
   int ansz=-1;
   
   for(int x =0;x<=N;x++)
   {
     for(int y=0;y<=N-x;y++)
     {
       z=N-x-y;
       if(10000*x+5000*y+1000*z==Y)
       {
         ansx=x;
         ansy=y;
         ansz=z;
         yen=true;
         break;
       }
     }
     if(yen) break;
   }
   System.out.println(ansx+" "+ansy+" "+ansz);
 }
} import java.util.Scanner; Scanner java.util public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int Y = sc.nextInt();
   boolean yen =false;
   int z =0;
 
   int ansx=-1;
   int ansy=-1;
   int ansz=-1;
   
   for(int x =0;x<=N;x++)
   {
     for(int y=0;y<=N-x;y++)
     {
       z=N-x-y;
       if(10000*x+5000*y+1000*z==Y)
       {
         ansx=x;
         ansy=y;
         ansz=z;
         yen=true;
         break;
       }
     }
     if(yen) break;
   }
   System.out.println(ansx+" "+ansy+" "+ansz);
 }
} Main public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int Y = sc.nextInt();
   boolean yen =false;
   int z =0;
 
   int ansx=-1;
   int ansy=-1;
   int ansz=-1;
   
   for(int x =0;x<=N;x++)
   {
     for(int y=0;y<=N-x;y++)
     {
       z=N-x-y;
       if(10000*x+5000*y+1000*z==Y)
       {
         ansx=x;
         ansy=y;
         ansz=z;
         yen=true;
         break;
       }
     }
     if(yen) break;
   }
   System.out.println(ansx+" "+ansy+" "+ansz);
 } main {
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int Y = sc.nextInt();
   boolean yen =false;
   int z =0;
 
   int ansx=-1;
   int ansy=-1;
   int ansz=-1;
   
   for(int x =0;x<=N;x++)
   {
     for(int y=0;y<=N-x;y++)
     {
       z=N-x-y;
       if(10000*x+5000*y+1000*z==Y)
       {
         ansx=x;
         ansy=y;
         ansz=z;
         yen=true;
         break;
       }
     }
     if(yen) break;
   }
   System.out.println(ansx+" "+ansy+" "+ansz);
 } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int Y = sc.nextInt(); Y sc.nextInt() sc.nextInt sc boolean yen =false; yen false int z =0; z 0 int ansx=-1; ansx -1 1 int ansy=-1; ansy -1 1 int ansz=-1; ansz -1 1 for(int x =0;x<=N;x++)
   {
     for(int y=0;y<=N-x;y++)
     {
       z=N-x-y;
       if(10000*x+5000*y+1000*z==Y)
       {
         ansx=x;
         ansy=y;
         ansz=z;
         yen=true;
         break;
       }
     }
     if(yen) break;
   } int x =0; int x =0; x 0 x<=N x N x++ x++ x {
     for(int y=0;y<=N-x;y++)
     {
       z=N-x-y;
       if(10000*x+5000*y+1000*z==Y)
       {
         ansx=x;
         ansy=y;
         ansz=z;
         yen=true;
         break;
       }
     }
     if(yen) break;
   } {
     for(int y=0;y<=N-x;y++)
     {
       z=N-x-y;
       if(10000*x+5000*y+1000*z==Y)
       {
         ansx=x;
         ansy=y;
         ansz=z;
         yen=true;
         break;
       }
     }
     if(yen) break;
   } for(int y=0;y<=N-x;y++)
     {
       z=N-x-y;
       if(10000*x+5000*y+1000*z==Y)
       {
         ansx=x;
         ansy=y;
         ansz=z;
         yen=true;
         break;
       }
     } int y=0; int y=0; y 0 y<=N-x y N-x N x y++ y++ y {
       z=N-x-y;
       if(10000*x+5000*y+1000*z==Y)
       {
         ansx=x;
         ansy=y;
         ansz=z;
         yen=true;
         break;
       }
     } {
       z=N-x-y;
       if(10000*x+5000*y+1000*z==Y)
       {
         ansx=x;
         ansy=y;
         ansz=z;
         yen=true;
         break;
       }
     } z=N-x-y z N-x-y N-x-y N x y if(10000*x+5000*y+1000*z==Y)
       {
         ansx=x;
         ansy=y;
         ansz=z;
         yen=true;
         break;
       } 10000*x+5000*y+1000*z==Y 10000*x+5000*y+1000*z 10000*x+5000*y+1000*z 10000*x 10000 x 5000*y 5000 y 1000*z 1000 z Y {
         ansx=x;
         ansy=y;
         ansz=z;
         yen=true;
         break;
       } ansx=x ansx x ansy=y ansy y ansz=z ansz z yen=true yen true break; if(yen) break; yen break; System.out.println(ansx+" "+ansy+" "+ansz) System.out.println System.out System System.out ansx+" "+ansy+" "+ansz " " ansy ansx+" "+ansy+" "+ansz ansx " " ansy " " ansz String[] args args public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int Y = sc.nextInt();
   boolean yen =false;
   int z =0;
 
   int ansx=-1;
   int ansy=-1;
   int ansz=-1;
   
   for(int x =0;x<=N;x++)
   {
     for(int y=0;y<=N-x;y++)
     {
       z=N-x-y;
       if(10000*x+5000*y+1000*z==Y)
       {
         ansx=x;
         ansy=y;
         ansz=z;
         yen=true;
         break;
       }
     }
     if(yen) break;
   }
   System.out.println(ansx+" "+ansy+" "+ansz);
 }
} public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int Y = sc.nextInt();
   boolean yen =false;
   int z =0;
 
   int ansx=-1;
   int ansy=-1;
   int ansz=-1;
   
   for(int x =0;x<=N;x++)
   {
     for(int y=0;y<=N-x;y++)
     {
       z=N-x-y;
       if(10000*x+5000*y+1000*z==Y)
       {
         ansx=x;
         ansy=y;
         ansz=z;
         yen=true;
         break;
       }
     }
     if(yen) break;
   }
   System.out.println(ansx+" "+ansy+" "+ansz);
 }
} Main
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int Y = sc.nextInt();
   boolean yen =false;
   int z =0;
 
   int ansx=-1;
   int ansy=-1;
   int ansz=-1;
   
   for(int x =0;x<=N;x++)
   {
     for(int y=0;y<=N-x;y++)
     {
       z=N-x-y;
       if(10000*x+5000*y+1000*z==Y)
       {
         ansx=x;
         ansy=y;
         ansz=z;
         yen=true;
         break;
       }
     }
     if(yen) break;
   }
   System.out.println(ansx+" "+ansy+" "+ansz);
 }
}