import java.util.Scanner;

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

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