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();
	 sc.close();
	        for(int j =0; j<=y/5000;j++) {
	        	for(int i =0; i<=y/10000; i++)  {
   		       
   			 int a = i;   int b = j;    int c= n-i-j;       
    	if(10000*a+5000*b+1000*c==y&&a>=0&&b>=0&&c>=0) {
    			System.out.println(a+" "+b+" "+c);
    			System.exit(0);}
    		}
      }
     System.out.println("-1 -1 -1");
        
	 }
} 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();
	 sc.close();
	        for(int j =0; j<=y/5000;j++) {
	        	for(int i =0; i<=y/10000; i++)  {
   		       
   			 int a = i;   int b = j;    int c= n-i-j;       
    	if(10000*a+5000*b+1000*c==y&&a>=0&&b>=0&&c>=0) {
    			System.out.println(a+" "+b+" "+c);
    			System.exit(0);}
    		}
      }
     System.out.println("-1 -1 -1");
        
	 }
} Main public static void main(String[] args) {
	 Scanner sc = new Scanner (System.in);
	 int n = sc.nextInt();  int y = sc.nextInt();
	 sc.close();
	        for(int j =0; j<=y/5000;j++) {
	        	for(int i =0; i<=y/10000; i++)  {
   		       
   			 int a = i;   int b = j;    int c= n-i-j;       
    	if(10000*a+5000*b+1000*c==y&&a>=0&&b>=0&&c>=0) {
    			System.out.println(a+" "+b+" "+c);
    			System.exit(0);}
    		}
      }
     System.out.println("-1 -1 -1");
        
	 } main {
	 Scanner sc = new Scanner (System.in);
	 int n = sc.nextInt();  int y = sc.nextInt();
	 sc.close();
	        for(int j =0; j<=y/5000;j++) {
	        	for(int i =0; i<=y/10000; i++)  {
   		       
   			 int a = i;   int b = j;    int c= n-i-j;       
    	if(10000*a+5000*b+1000*c==y&&a>=0&&b>=0&&c>=0) {
    			System.out.println(a+" "+b+" "+c);
    			System.exit(0);}
    		}
      }
     System.out.println("-1 -1 -1");
        
	 } 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 sc.close() sc.close sc for(int j =0; j<=y/5000;j++) {
	        	for(int i =0; i<=y/10000; i++)  {
   		       
   			 int a = i;   int b = j;    int c= n-i-j;       
    	if(10000*a+5000*b+1000*c==y&&a>=0&&b>=0&&c>=0) {
    			System.out.println(a+" "+b+" "+c);
    			System.exit(0);}
    		}
      } int j =0; int j =0; j 0 j<=y/5000 j y/5000 y 5000 j++ j++ j {
	        	for(int i =0; i<=y/10000; i++)  {
   		       
   			 int a = i;   int b = j;    int c= n-i-j;       
    	if(10000*a+5000*b+1000*c==y&&a>=0&&b>=0&&c>=0) {
    			System.out.println(a+" "+b+" "+c);
    			System.exit(0);}
    		}
      } {
	        	for(int i =0; i<=y/10000; i++)  {
   		       
   			 int a = i;   int b = j;    int c= n-i-j;       
    	if(10000*a+5000*b+1000*c==y&&a>=0&&b>=0&&c>=0) {
    			System.out.println(a+" "+b+" "+c);
    			System.exit(0);}
    		}
      } for(int i =0; i<=y/10000; i++)  {
   		       
   			 int a = i;   int b = j;    int c= n-i-j;       
    	if(10000*a+5000*b+1000*c==y&&a>=0&&b>=0&&c>=0) {
    			System.out.println(a+" "+b+" "+c);
    			System.exit(0);}
    		} int i =0; int i =0; i 0 i<=y/10000 i y/10000 y 10000 i++ i++ i {
   		       
   			 int a = i;   int b = j;    int c= n-i-j;       
    	if(10000*a+5000*b+1000*c==y&&a>=0&&b>=0&&c>=0) {
    			System.out.println(a+" "+b+" "+c);
    			System.exit(0);}
    		} {
   		       
   			 int a = i;   int b = j;    int c= n-i-j;       
    	if(10000*a+5000*b+1000*c==y&&a>=0&&b>=0&&c>=0) {
    			System.out.println(a+" "+b+" "+c);
    			System.exit(0);}
    		} int a = i; a i int b = j; b j int c= n-i-j; c n-i-j n-i-j n i j if(10000*a+5000*b+1000*c==y&&a>=0&&b>=0&&c>=0) {
    			System.out.println(a+" "+b+" "+c);
    			System.exit(0);} 10000*a+5000*b+1000*c==y&&a>=0&&b>=0&&c>=0 b>=0 10000*a+5000*b+1000*c==y&&a>=0&&b>=0&&c>=0 10000*a+5000*b+1000*c==y 10000*a+5000*b+1000*c 10000*a+5000*b+1000*c 10000*a 10000 a 5000*b 5000 b 1000*c 1000 c y a>=0 a 0 b>=0 b 0 c>=0 c 0 {
    			System.out.println(a+" "+b+" "+c);
    			System.exit(0);} System.out.println(a+" "+b+" "+c) System.out.println System.out System System.out a+" "+b+" "+c " " b a+" "+b+" "+c a " " b " " c System.exit(0) System.exit System 0 System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" 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();
	 sc.close();
	        for(int j =0; j<=y/5000;j++) {
	        	for(int i =0; i<=y/10000; i++)  {
   		       
   			 int a = i;   int b = j;    int c= n-i-j;       
    	if(10000*a+5000*b+1000*c==y&&a>=0&&b>=0&&c>=0) {
    			System.out.println(a+" "+b+" "+c);
    			System.exit(0);}
    		}
      }
     System.out.println("-1 -1 -1");
        
	 }
} public class Main {
      
	public static void main(String[] args) {
	 Scanner sc = new Scanner (System.in);
	 int n = sc.nextInt();  int y = sc.nextInt();
	 sc.close();
	        for(int j =0; j<=y/5000;j++) {
	        	for(int i =0; i<=y/10000; i++)  {
   		       
   			 int a = i;   int b = j;    int c= n-i-j;       
    	if(10000*a+5000*b+1000*c==y&&a>=0&&b>=0&&c>=0) {
    			System.out.println(a+" "+b+" "+c);
    			System.exit(0);}
    		}
      }
     System.out.println("-1 -1 -1");
        
	 }
} 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();
	 sc.close();
	        for(int j =0; j<=y/5000;j++) {
	        	for(int i =0; i<=y/10000; i++)  {
   		       
   			 int a = i;   int b = j;    int c= n-i-j;       
    	if(10000*a+5000*b+1000*c==y&&a>=0&&b>=0&&c>=0) {
    			System.out.println(a+" "+b+" "+c);
    			System.exit(0);}
    		}
      }
     System.out.println("-1 -1 -1");
        
	 }
}
