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; j <= n - i; j++){
            	int x = n - i - j;
                int sum = 10000 * i + 5000 * j + 1000 * x;
                if(sum == y){
                	System.out.println(i + " " + j + " " + x);
                    return;
                }
            }
        }
        System.out.println(-1 + " " + -1 + " " + -1);
    }
} 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; j <= n - i; j++){
            	int x = n - i - j;
                int sum = 10000 * i + 5000 * j + 1000 * x;
                if(sum == y){
                	System.out.println(i + " " + j + " " + x);
                    return;
                }
            }
        }
        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();
        for(int i = 0; i <= n; i++){
        	for(int j = 0; j <= n - i; j++){
            	int x = n - i - j;
                int sum = 10000 * i + 5000 * j + 1000 * x;
                if(sum == y){
                	System.out.println(i + " " + j + " " + x);
                    return;
                }
            }
        }
        System.out.println(-1 + " " + -1 + " " + -1);
    } 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; j <= n - i; j++){
            	int x = n - i - j;
                int sum = 10000 * i + 5000 * j + 1000 * x;
                if(sum == y){
                	System.out.println(i + " " + j + " " + x);
                    return;
                }
            }
        }
        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 for(int i = 0; i <= n; i++){
        	for(int j = 0; j <= n - i; j++){
            	int x = n - i - j;
                int sum = 10000 * i + 5000 * j + 1000 * x;
                if(sum == y){
                	System.out.println(i + " " + j + " " + x);
                    return;
                }
            }
        } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
        	for(int j = 0; j <= n - i; j++){
            	int x = n - i - j;
                int sum = 10000 * i + 5000 * j + 1000 * x;
                if(sum == y){
                	System.out.println(i + " " + j + " " + x);
                    return;
                }
            }
        } {
        	for(int j = 0; j <= n - i; j++){
            	int x = n - i - j;
                int sum = 10000 * i + 5000 * j + 1000 * x;
                if(sum == y){
                	System.out.println(i + " " + j + " " + x);
                    return;
                }
            }
        } for(int j = 0; j <= n - i; j++){
            	int x = n - i - j;
                int sum = 10000 * i + 5000 * j + 1000 * x;
                if(sum == y){
                	System.out.println(i + " " + j + " " + x);
                    return;
                }
            } int j = 0; int j = 0; j 0 j <= n - i j n - i n i j++ j++ j {
            	int x = n - i - j;
                int sum = 10000 * i + 5000 * j + 1000 * x;
                if(sum == y){
                	System.out.println(i + " " + j + " " + x);
                    return;
                }
            } {
            	int x = n - i - j;
                int sum = 10000 * i + 5000 * j + 1000 * x;
                if(sum == y){
                	System.out.println(i + " " + j + " " + x);
                    return;
                }
            } int x = n - i - j; x n - i - j n - i - j n i j int sum = 10000 * i + 5000 * j + 1000 * x; sum 10000 * i + 5000 * j + 1000 * x 10000 * i + 5000 * j + 1000 * x 10000 * i 10000 i 5000 * j 5000 j 1000 * x 1000 x if(sum == y){
                	System.out.println(i + " " + j + " " + x);
                    return;
                } sum == y sum y {
                	System.out.println(i + " " + j + " " + x);
                    return;
                } System.out.println(i + " " + j + " " + x) System.out.println System.out System System.out i + " " + j + " " + x " " j i + " " + j + " " + x i " " j " " x return; System.out.println(-1 + " " + -1 + " " + -1) System.out.println System.out System System.out -1 + " " + -1 + " " + -1 " " -1 -1 + " " + -1 + " " + -1 -1 1 " " -1 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();
        for(int i = 0; i <= n; i++){
        	for(int j = 0; j <= n - i; j++){
            	int x = n - i - j;
                int sum = 10000 * i + 5000 * j + 1000 * x;
                if(sum == y){
                	System.out.println(i + " " + j + " " + x);
                    return;
                }
            }
        }
        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();
        for(int i = 0; i <= n; i++){
        	for(int j = 0; j <= n - i; j++){
            	int x = n - i - j;
                int sum = 10000 * i + 5000 * j + 1000 * x;
                if(sum == y){
                	System.out.println(i + " " + j + " " + x);
                    return;
                }
            }
        }
        System.out.println(-1 + " " + -1 + " " + -1);
    }
} 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; j <= n - i; j++){
            	int x = n - i - j;
                int sum = 10000 * i + 5000 * j + 1000 * x;
                if(sum == y){
                	System.out.println(i + " " + j + " " + x);
                    return;
                }
            }
        }
        System.out.println(-1 + " " + -1 + " " + -1);
    }
}