import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int res10000 = -1;
        int res5000 = -1;
        int res1000 = -1;

        for (int a = 0; a <= N; a++ ) {
            for (int b = 0; b + a <= N; b++) {
                int c = N - a - b;
                int total = 10000 * a + 5000 * b + 1000 * c;
                if (total == Y) {
                    res10000 = a;
                    res5000 = b;
                    res1000 = c;
                }
            }
        }
        
        System.out.println(res10000 + " " + res5000 + " " + res1000);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int res10000 = -1;
        int res5000 = -1;
        int res1000 = -1;

        for (int a = 0; a <= N; a++ ) {
            for (int b = 0; b + a <= N; b++) {
                int c = N - a - b;
                int total = 10000 * a + 5000 * b + 1000 * c;
                if (total == Y) {
                    res10000 = a;
                    res5000 = b;
                    res1000 = c;
                }
            }
        }
        
        System.out.println(res10000 + " " + res5000 + " " + res1000);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int res10000 = -1;
        int res5000 = -1;
        int res1000 = -1;

        for (int a = 0; a <= N; a++ ) {
            for (int b = 0; b + a <= N; b++) {
                int c = N - a - b;
                int total = 10000 * a + 5000 * b + 1000 * c;
                if (total == Y) {
                    res10000 = a;
                    res5000 = b;
                    res1000 = c;
                }
            }
        }
        
        System.out.println(res10000 + " " + res5000 + " " + res1000);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int res10000 = -1;
        int res5000 = -1;
        int res1000 = -1;

        for (int a = 0; a <= N; a++ ) {
            for (int b = 0; b + a <= N; b++) {
                int c = N - a - b;
                int total = 10000 * a + 5000 * b + 1000 * c;
                if (total == Y) {
                    res10000 = a;
                    res5000 = b;
                    res1000 = c;
                }
            }
        }
        
        System.out.println(res10000 + " " + res5000 + " " + res1000);
    } 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 int res10000 = -1; res10000 -1 1 int res5000 = -1; res5000 -1 1 int res1000 = -1; res1000 -1 1 for (int a = 0; a <= N; a++ ) {
            for (int b = 0; b + a <= N; b++) {
                int c = N - a - b;
                int total = 10000 * a + 5000 * b + 1000 * c;
                if (total == Y) {
                    res10000 = a;
                    res5000 = b;
                    res1000 = c;
                }
            }
        } int a = 0; int a = 0; a 0 a <= N a N a++ a++ a {
            for (int b = 0; b + a <= N; b++) {
                int c = N - a - b;
                int total = 10000 * a + 5000 * b + 1000 * c;
                if (total == Y) {
                    res10000 = a;
                    res5000 = b;
                    res1000 = c;
                }
            }
        } {
            for (int b = 0; b + a <= N; b++) {
                int c = N - a - b;
                int total = 10000 * a + 5000 * b + 1000 * c;
                if (total == Y) {
                    res10000 = a;
                    res5000 = b;
                    res1000 = c;
                }
            }
        } for (int b = 0; b + a <= N; b++) {
                int c = N - a - b;
                int total = 10000 * a + 5000 * b + 1000 * c;
                if (total == Y) {
                    res10000 = a;
                    res5000 = b;
                    res1000 = c;
                }
            } int b = 0; int b = 0; b 0 b + a <= N b + a b a N b++ b++ b {
                int c = N - a - b;
                int total = 10000 * a + 5000 * b + 1000 * c;
                if (total == Y) {
                    res10000 = a;
                    res5000 = b;
                    res1000 = c;
                }
            } {
                int c = N - a - b;
                int total = 10000 * a + 5000 * b + 1000 * c;
                if (total == Y) {
                    res10000 = a;
                    res5000 = b;
                    res1000 = c;
                }
            } int c = N - a - b; c N - a - b N - a - b N a b int total = 10000 * a + 5000 * b + 1000 * c; total 10000 * a + 5000 * b + 1000 * c 10000 * a + 5000 * b + 1000 * c 10000 * a 10000 a 5000 * b 5000 b 1000 * c 1000 c if (total == Y) {
                    res10000 = a;
                    res5000 = b;
                    res1000 = c;
                } total == Y total Y {
                    res10000 = a;
                    res5000 = b;
                    res1000 = c;
                } res10000 = a res10000 a res5000 = b res5000 b res1000 = c res1000 c System.out.println(res10000 + " " + res5000 + " " + res1000) System.out.println System.out System System.out res10000 + " " + res5000 + " " + res1000 " " res5000 res10000 + " " + res5000 + " " + res1000 res10000 " " res5000 " " res1000 String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int res10000 = -1;
        int res5000 = -1;
        int res1000 = -1;

        for (int a = 0; a <= N; a++ ) {
            for (int b = 0; b + a <= N; b++) {
                int c = N - a - b;
                int total = 10000 * a + 5000 * b + 1000 * c;
                if (total == Y) {
                    res10000 = a;
                    res5000 = b;
                    res1000 = c;
                }
            }
        }
        
        System.out.println(res10000 + " " + res5000 + " " + res1000);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int res10000 = -1;
        int res5000 = -1;
        int res1000 = -1;

        for (int a = 0; a <= N; a++ ) {
            for (int b = 0; b + a <= N; b++) {
                int c = N - a - b;
                int total = 10000 * a + 5000 * b + 1000 * c;
                if (total == Y) {
                    res10000 = a;
                    res5000 = b;
                    res1000 = c;
                }
            }
        }
        
        System.out.println(res10000 + " " + res5000 + " " + res1000);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int res10000 = -1;
        int res5000 = -1;
        int res1000 = -1;

        for (int a = 0; a <= N; a++ ) {
            for (int b = 0; b + a <= N; b++) {
                int c = N - a - b;
                int total = 10000 * a + 5000 * b + 1000 * c;
                if (total == Y) {
                    res10000 = a;
                    res5000 = b;
                    res1000 = c;
                }
            }
        }
        
        System.out.println(res10000 + " " + res5000 + " " + res1000);
    }
}