import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);

        int resultX = -1,resultY = -1,resultZ = -1;
        boolean flag = false;
        int n = sc.nextInt();
        int total = sc.nextInt();
        
        for (int x = 0; x <= n; x++){
            for (int y = 0; y + x <= n; y++){
                int z = n - x - y;
                if (total == 10000*x + 5000*y + 1000*z) {
                    resultX = x;
                    resultY = y;
                    resultZ = z;
                    flag = true;
                    break;
                }
            }
            
            if (flag) break;
        }
        
        System.out.printf("%d %d %d", resultX, resultY, resultZ);
        sc.close();
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);

        int resultX = -1,resultY = -1,resultZ = -1;
        boolean flag = false;
        int n = sc.nextInt();
        int total = sc.nextInt();
        
        for (int x = 0; x <= n; x++){
            for (int y = 0; y + x <= n; y++){
                int z = n - x - y;
                if (total == 10000*x + 5000*y + 1000*z) {
                    resultX = x;
                    resultY = y;
                    resultZ = z;
                    flag = true;
                    break;
                }
            }
            
            if (flag) break;
        }
        
        System.out.printf("%d %d %d", resultX, resultY, resultZ);
        sc.close();
    }
} Main public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);

        int resultX = -1,resultY = -1,resultZ = -1;
        boolean flag = false;
        int n = sc.nextInt();
        int total = sc.nextInt();
        
        for (int x = 0; x <= n; x++){
            for (int y = 0; y + x <= n; y++){
                int z = n - x - y;
                if (total == 10000*x + 5000*y + 1000*z) {
                    resultX = x;
                    resultY = y;
                    resultZ = z;
                    flag = true;
                    break;
                }
            }
            
            if (flag) break;
        }
        
        System.out.printf("%d %d %d", resultX, resultY, resultZ);
        sc.close();
    } main {
        
        Scanner sc = new Scanner(System.in);

        int resultX = -1,resultY = -1,resultZ = -1;
        boolean flag = false;
        int n = sc.nextInt();
        int total = sc.nextInt();
        
        for (int x = 0; x <= n; x++){
            for (int y = 0; y + x <= n; y++){
                int z = n - x - y;
                if (total == 10000*x + 5000*y + 1000*z) {
                    resultX = x;
                    resultY = y;
                    resultZ = z;
                    flag = true;
                    break;
                }
            }
            
            if (flag) break;
        }
        
        System.out.printf("%d %d %d", resultX, resultY, resultZ);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int resultX = -1 resultX -1 1 resultY = -1 resultY -1 1 resultZ = -1; resultZ -1 1 boolean flag = false; flag false int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int total = sc.nextInt(); total sc.nextInt() sc.nextInt sc for (int x = 0; x <= n; x++){
            for (int y = 0; y + x <= n; y++){
                int z = n - x - y;
                if (total == 10000*x + 5000*y + 1000*z) {
                    resultX = x;
                    resultY = y;
                    resultZ = z;
                    flag = true;
                    break;
                }
            }
            
            if (flag) break;
        } int x = 0; int x = 0; x 0 x <= n x n x++ x++ x {
            for (int y = 0; y + x <= n; y++){
                int z = n - x - y;
                if (total == 10000*x + 5000*y + 1000*z) {
                    resultX = x;
                    resultY = y;
                    resultZ = z;
                    flag = true;
                    break;
                }
            }
            
            if (flag) break;
        } {
            for (int y = 0; y + x <= n; y++){
                int z = n - x - y;
                if (total == 10000*x + 5000*y + 1000*z) {
                    resultX = x;
                    resultY = y;
                    resultZ = z;
                    flag = true;
                    break;
                }
            }
            
            if (flag) break;
        } for (int y = 0; y + x <= n; y++){
                int z = n - x - y;
                if (total == 10000*x + 5000*y + 1000*z) {
                    resultX = x;
                    resultY = y;
                    resultZ = z;
                    flag = true;
                    break;
                }
            } int y = 0; int y = 0; y 0 y + x <= n y + x y x n y++ y++ y {
                int z = n - x - y;
                if (total == 10000*x + 5000*y + 1000*z) {
                    resultX = x;
                    resultY = y;
                    resultZ = z;
                    flag = true;
                    break;
                }
            } {
                int z = n - x - y;
                if (total == 10000*x + 5000*y + 1000*z) {
                    resultX = x;
                    resultY = y;
                    resultZ = z;
                    flag = true;
                    break;
                }
            } int z = n - x - y; z n - x - y n - x - y n x y if (total == 10000*x + 5000*y + 1000*z) {
                    resultX = x;
                    resultY = y;
                    resultZ = z;
                    flag = true;
                    break;
                } total == 10000*x + 5000*y + 1000*z total 10000*x + 5000*y + 1000*z 10000*x + 5000*y + 1000*z 10000*x 10000 x 5000*y 5000 y 1000*z 1000 z {
                    resultX = x;
                    resultY = y;
                    resultZ = z;
                    flag = true;
                    break;
                } resultX = x resultX x resultY = y resultY y resultZ = z resultZ z flag = true flag true break; if (flag) break; flag break; System.out.printf("%d %d %d", resultX, resultY, resultZ) System.out.printf System.out System System.out "%d %d %d" resultX resultY resultZ sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);

        int resultX = -1,resultY = -1,resultZ = -1;
        boolean flag = false;
        int n = sc.nextInt();
        int total = sc.nextInt();
        
        for (int x = 0; x <= n; x++){
            for (int y = 0; y + x <= n; y++){
                int z = n - x - y;
                if (total == 10000*x + 5000*y + 1000*z) {
                    resultX = x;
                    resultY = y;
                    resultZ = z;
                    flag = true;
                    break;
                }
            }
            
            if (flag) break;
        }
        
        System.out.printf("%d %d %d", resultX, resultY, resultZ);
        sc.close();
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);

        int resultX = -1,resultY = -1,resultZ = -1;
        boolean flag = false;
        int n = sc.nextInt();
        int total = sc.nextInt();
        
        for (int x = 0; x <= n; x++){
            for (int y = 0; y + x <= n; y++){
                int z = n - x - y;
                if (total == 10000*x + 5000*y + 1000*z) {
                    resultX = x;
                    resultY = y;
                    resultZ = z;
                    flag = true;
                    break;
                }
            }
            
            if (flag) break;
        }
        
        System.out.printf("%d %d %d", resultX, resultY, resultZ);
        sc.close();
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);

        int resultX = -1,resultY = -1,resultZ = -1;
        boolean flag = false;
        int n = sc.nextInt();
        int total = sc.nextInt();
        
        for (int x = 0; x <= n; x++){
            for (int y = 0; y + x <= n; y++){
                int z = n - x - y;
                if (total == 10000*x + 5000*y + 1000*z) {
                    resultX = x;
                    resultY = y;
                    resultZ = z;
                    flag = true;
                    break;
                }
            }
            
            if (flag) break;
        }
        
        System.out.printf("%d %d %d", resultX, resultY, resultZ);
        sc.close();
    }
}