import java.util.*;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            int[] res = {-1, -1, -1}; // 10000, 5000, 1000
            int n = sc.nextInt();
            int target = sc.nextInt();
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    int k = n - i - j;
                    int total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == target) {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    }
                }
            }
            System.out.println(String.format("%d %d %d", res[0], res[1], res[2]));
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            int[] res = {-1, -1, -1}; // 10000, 5000, 1000
            int n = sc.nextInt();
            int target = sc.nextInt();
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    int k = n - i - j;
                    int total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == target) {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    }
                }
            }
            System.out.println(String.format("%d %d %d", res[0], res[1], res[2]));
        }
    }
} Main public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            int[] res = {-1, -1, -1}; // 10000, 5000, 1000
            int n = sc.nextInt();
            int target = sc.nextInt();
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    int k = n - i - j;
                    int total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == target) {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    }
                }
            }
            System.out.println(String.format("%d %d %d", res[0], res[1], res[2]));
        }
    } main {
        try (Scanner sc = new Scanner(System.in);) {
            int[] res = {-1, -1, -1}; // 10000, 5000, 1000
            int n = sc.nextInt();
            int target = sc.nextInt();
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    int k = n - i - j;
                    int total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == target) {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    }
                }
            }
            System.out.println(String.format("%d %d %d", res[0], res[1], res[2]));
        }
    } try (Scanner sc = new Scanner(System.in);) {
            int[] res = {-1, -1, -1}; // 10000, 5000, 1000
            int n = sc.nextInt();
            int target = sc.nextInt();
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    int k = n - i - j;
                    int total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == target) {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    }
                }
            }
            System.out.println(String.format("%d %d %d", res[0], res[1], res[2]));
        } {
            int[] res = {-1, -1, -1}; // 10000, 5000, 1000
            int n = sc.nextInt();
            int target = sc.nextInt();
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    int k = n - i - j;
                    int total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == target) {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    }
                }
            }
            System.out.println(String.format("%d %d %d", res[0], res[1], res[2]));
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) int[] res = {-1, -1, -1}; res {-1, -1, -1} -1 1 -1 1 -1 1 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int target = sc.nextInt(); target sc.nextInt() sc.nextInt sc for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    int k = n - i - j;
                    int total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == target) {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    }
                }
            } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
                for (int j = 0; j <= n - i; j++) {
                    int k = n - i - j;
                    int total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == target) {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    }
                }
            } {
                for (int j = 0; j <= n - i; j++) {
                    int k = n - i - j;
                    int total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == target) {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    }
                }
            } for (int j = 0; j <= n - i; j++) {
                    int k = n - i - j;
                    int total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == target) {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    }
                } int j = 0; int j = 0; j 0 j <= n - i j n - i n i j++ j++ j {
                    int k = n - i - j;
                    int total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == target) {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    }
                } {
                    int k = n - i - j;
                    int total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == target) {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    }
                } int k = n - i - j; k n - i - j n - i - j n i j int total = 10000 * i + 5000 * j + 1000 * k; total 10000 * i + 5000 * j + 1000 * k 10000 * i + 5000 * j + 1000 * k 10000 * i 10000 i 5000 * j 5000 j 1000 * k 1000 k if (total == target) {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    } total == target total target {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    } res[0] = i res[0] res 0 i res[1] = j res[1] res 1 j res[2] = k res[2] res 2 k System.out.println(String.format("%d %d %d", res[0], res[1], res[2])) System.out.println System.out System System.out String.format("%d %d %d", res[0], res[1], res[2]) String.format String "%d %d %d" res[0] res 0 res[1] res 1 res[2] res 2 String[] args args public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            int[] res = {-1, -1, -1}; // 10000, 5000, 1000
            int n = sc.nextInt();
            int target = sc.nextInt();
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    int k = n - i - j;
                    int total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == target) {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    }
                }
            }
            System.out.println(String.format("%d %d %d", res[0], res[1], res[2]));
        }
    }
} public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            int[] res = {-1, -1, -1}; // 10000, 5000, 1000
            int n = sc.nextInt();
            int target = sc.nextInt();
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    int k = n - i - j;
                    int total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == target) {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    }
                }
            }
            System.out.println(String.format("%d %d %d", res[0], res[1], res[2]));
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            int[] res = {-1, -1, -1}; // 10000, 5000, 1000
            int n = sc.nextInt();
            int target = sc.nextInt();
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n - i; j++) {
                    int k = n - i - j;
                    int total = 10000 * i + 5000 * j + 1000 * k;
                    if (total == target) {
                        res[0] = i;
                        res[1] = j;
                        res[2] = k;
                    }
                }
            }
            System.out.println(String.format("%d %d %d", res[0], res[1], res[2]));
        }
    }
}