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