import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int nam = sc.nextInt();
      	int yen = sc.nextInt();
      
      int r10000 = -1; int r5000 = -1; int r1000 = -1;
      		
 		for(int a = 0;a <= nam ;a++){
          	for(int b = 0;a+b <= nam ; b++){
              int	c = nam-a-b;
              	int sum = a*10000 + b*5000 + c*1000;
              	if(sum == yen){
                	r10000 = a;
                  	r5000  = b;
                  	r1000  = c;
                  System.out.print(r10000 +" "+r5000+" "+r1000);
                  System.exit(0); 
                }
            }
        }
      System.out.print(r10000 +" "+r5000+" "+r1000);
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int nam = sc.nextInt();
      	int yen = sc.nextInt();
      
      int r10000 = -1; int r5000 = -1; int r1000 = -1;
      		
 		for(int a = 0;a <= nam ;a++){
          	for(int b = 0;a+b <= nam ; b++){
              int	c = nam-a-b;
              	int sum = a*10000 + b*5000 + c*1000;
              	if(sum == yen){
                	r10000 = a;
                  	r5000  = b;
                  	r1000  = c;
                  System.out.print(r10000 +" "+r5000+" "+r1000);
                  System.exit(0); 
                }
            }
        }
      System.out.print(r10000 +" "+r5000+" "+r1000);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int nam = sc.nextInt();
      	int yen = sc.nextInt();
      
      int r10000 = -1; int r5000 = -1; int r1000 = -1;
      		
 		for(int a = 0;a <= nam ;a++){
          	for(int b = 0;a+b <= nam ; b++){
              int	c = nam-a-b;
              	int sum = a*10000 + b*5000 + c*1000;
              	if(sum == yen){
                	r10000 = a;
                  	r5000  = b;
                  	r1000  = c;
                  System.out.print(r10000 +" "+r5000+" "+r1000);
                  System.exit(0); 
                }
            }
        }
      System.out.print(r10000 +" "+r5000+" "+r1000);
    } main {
        Scanner sc = new Scanner(System.in);
        int nam = sc.nextInt();
      	int yen = sc.nextInt();
      
      int r10000 = -1; int r5000 = -1; int r1000 = -1;
      		
 		for(int a = 0;a <= nam ;a++){
          	for(int b = 0;a+b <= nam ; b++){
              int	c = nam-a-b;
              	int sum = a*10000 + b*5000 + c*1000;
              	if(sum == yen){
                	r10000 = a;
                  	r5000  = b;
                  	r1000  = c;
                  System.out.print(r10000 +" "+r5000+" "+r1000);
                  System.exit(0); 
                }
            }
        }
      System.out.print(r10000 +" "+r5000+" "+r1000);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int nam = sc.nextInt(); nam sc.nextInt() sc.nextInt sc int yen = sc.nextInt(); yen sc.nextInt() sc.nextInt sc int r10000 = -1; r10000 -1 1 int r5000 = -1; r5000 -1 1 int r1000 = -1; r1000 -1 1 for(int a = 0;a <= nam ;a++){
          	for(int b = 0;a+b <= nam ; b++){
              int	c = nam-a-b;
              	int sum = a*10000 + b*5000 + c*1000;
              	if(sum == yen){
                	r10000 = a;
                  	r5000  = b;
                  	r1000  = c;
                  System.out.print(r10000 +" "+r5000+" "+r1000);
                  System.exit(0); 
                }
            }
        } int a = 0; int a = 0; a 0 a <= nam a nam a++ a++ a {
          	for(int b = 0;a+b <= nam ; b++){
              int	c = nam-a-b;
              	int sum = a*10000 + b*5000 + c*1000;
              	if(sum == yen){
                	r10000 = a;
                  	r5000  = b;
                  	r1000  = c;
                  System.out.print(r10000 +" "+r5000+" "+r1000);
                  System.exit(0); 
                }
            }
        } {
          	for(int b = 0;a+b <= nam ; b++){
              int	c = nam-a-b;
              	int sum = a*10000 + b*5000 + c*1000;
              	if(sum == yen){
                	r10000 = a;
                  	r5000  = b;
                  	r1000  = c;
                  System.out.print(r10000 +" "+r5000+" "+r1000);
                  System.exit(0); 
                }
            }
        } for(int b = 0;a+b <= nam ; b++){
              int	c = nam-a-b;
              	int sum = a*10000 + b*5000 + c*1000;
              	if(sum == yen){
                	r10000 = a;
                  	r5000  = b;
                  	r1000  = c;
                  System.out.print(r10000 +" "+r5000+" "+r1000);
                  System.exit(0); 
                }
            } int b = 0; int b = 0; b 0 a+b <= nam a+b a b nam b++ b++ b {
              int	c = nam-a-b;
              	int sum = a*10000 + b*5000 + c*1000;
              	if(sum == yen){
                	r10000 = a;
                  	r5000  = b;
                  	r1000  = c;
                  System.out.print(r10000 +" "+r5000+" "+r1000);
                  System.exit(0); 
                }
            } {
              int	c = nam-a-b;
              	int sum = a*10000 + b*5000 + c*1000;
              	if(sum == yen){
                	r10000 = a;
                  	r5000  = b;
                  	r1000  = c;
                  System.out.print(r10000 +" "+r5000+" "+r1000);
                  System.exit(0); 
                }
            } int	c = nam-a-b; c nam-a-b nam-a-b nam a b int sum = a*10000 + b*5000 + c*1000; sum a*10000 + b*5000 + c*1000 a*10000 + b*5000 + c*1000 a*10000 a 10000 b*5000 b 5000 c*1000 c 1000 if(sum == yen){
                	r10000 = a;
                  	r5000  = b;
                  	r1000  = c;
                  System.out.print(r10000 +" "+r5000+" "+r1000);
                  System.exit(0); 
                } sum == yen sum yen {
                	r10000 = a;
                  	r5000  = b;
                  	r1000  = c;
                  System.out.print(r10000 +" "+r5000+" "+r1000);
                  System.exit(0); 
                } r10000 = a r10000 a r5000  = b r5000 b r1000  = c r1000 c System.out.print(r10000 +" "+r5000+" "+r1000) System.out.print System.out System System.out r10000 +" "+r5000+" "+r1000 " " r5000 r10000 +" "+r5000+" "+r1000 r10000 " " r5000 " " r1000 System.exit(0) System.exit System 0 System.out.print(r10000 +" "+r5000+" "+r1000) System.out.print System.out System System.out r10000 +" "+r5000+" "+r1000 " " r5000 r10000 +" "+r5000+" "+r1000 r10000 " " r5000 " " r1000 String[] args args
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int nam = sc.nextInt();
      	int yen = sc.nextInt();
      
      int r10000 = -1; int r5000 = -1; int r1000 = -1;
      		
 		for(int a = 0;a <= nam ;a++){
          	for(int b = 0;a+b <= nam ; b++){
              int	c = nam-a-b;
              	int sum = a*10000 + b*5000 + c*1000;
              	if(sum == yen){
                	r10000 = a;
                  	r5000  = b;
                  	r1000  = c;
                  System.out.print(r10000 +" "+r5000+" "+r1000);
                  System.exit(0); 
                }
            }
        }
      System.out.print(r10000 +" "+r5000+" "+r1000);
    }
}