import java.util.*;
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 total = 10000 * i + 5000 * j + 1000 * (N - i - j);
                if (total == Y) {
                    System.out.println(" " + i + " " + j + " " + (N - i - j));
                    return;
                }
            }
        }
        System.out.println(" " + -1 + " " + -1 + " " + -1);
        return;
    }
} import java.util.*; util.* java 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 total = 10000 * i + 5000 * j + 1000 * (N - i - j);
                if (total == Y) {
                    System.out.println(" " + i + " " + j + " " + (N - i - j));
                    return;
                }
            }
        }
        System.out.println(" " + -1 + " " + -1 + " " + -1);
        return;
    }
} 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 total = 10000 * i + 5000 * j + 1000 * (N - i - j);
                if (total == Y) {
                    System.out.println(" " + i + " " + j + " " + (N - i - j));
                    return;
                }
            }
        }
        System.out.println(" " + -1 + " " + -1 + " " + -1);
        return;
    } 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 total = 10000 * i + 5000 * j + 1000 * (N - i - j);
                if (total == Y) {
                    System.out.println(" " + i + " " + j + " " + (N - i - j));
                    return;
                }
            }
        }
        System.out.println(" " + -1 + " " + -1 + " " + -1);
        return;
    } 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 total = 10000 * i + 5000 * j + 1000 * (N - i - j);
                if (total == Y) {
                    System.out.println(" " + i + " " + j + " " + (N - i - j));
                    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 total = 10000 * i + 5000 * j + 1000 * (N - i - j);
                if (total == Y) {
                    System.out.println(" " + i + " " + j + " " + (N - i - j));
                    return;
                }
            }
        } {
            for (int j = 0; j <= N - i; j++) {  
                int total = 10000 * i + 5000 * j + 1000 * (N - i - j);
                if (total == Y) {
                    System.out.println(" " + i + " " + j + " " + (N - i - j));
                    return;
                }
            }
        } for (int j = 0; j <= N - i; j++) {  
                int total = 10000 * i + 5000 * j + 1000 * (N - i - j);
                if (total == Y) {
                    System.out.println(" " + i + " " + j + " " + (N - i - j));
                    return;
                }
            } int j = 0; int j = 0; j 0 j <= N - i j N - i N i j++ j++ j {  
                int total = 10000 * i + 5000 * j + 1000 * (N - i - j);
                if (total == Y) {
                    System.out.println(" " + i + " " + j + " " + (N - i - j));
                    return;
                }
            } {  
                int total = 10000 * i + 5000 * j + 1000 * (N - i - j);
                if (total == Y) {
                    System.out.println(" " + i + " " + j + " " + (N - i - j));
                    return;
                }
            } int total = 10000 * i + 5000 * j + 1000 * (N - i - j); total 10000 * i + 5000 * j + 1000 * (N - i - j) 10000 * i + 5000 * j + 1000 * (N - i - j) 10000 * i 10000 i 5000 * j 5000 j 1000 * (N - i - j) 1000 (N - i - j) N - i - j N i j if (total == Y) {
                    System.out.println(" " + i + " " + j + " " + (N - i - j));
                    return;
                } total == Y total Y {
                    System.out.println(" " + i + " " + j + " " + (N - i - j));
                    return;
                } System.out.println(" " + i + " " + j + " " + (N - i - j)) System.out.println System.out System System.out " " + i + " " + j + " " + (N - i - j) " " j " " " " + i + " " + j + " " + (N - i - j) " " i " " j " " (N - i - j) N - i - j N i j 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 return; String[] args args
import java.util.*;
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 total = 10000 * i + 5000 * j + 1000 * (N - i - j);
                if (total == Y) {
                    System.out.println(" " + i + " " + j + " " + (N - i - j));
                    return;
                }
            }
        }
        System.out.println(" " + -1 + " " + -1 + " " + -1);
        return;
    }
}