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();
        sc.close();

        int cnt10000 = -1;
        int cnt5000  = -1;
        int cnt1000  = -1;
        for(int i=0; i<=n; i++) {
            for(int j=0; j<=n-i; j++) {
                int k = n-i-j;
                if(10000*i + 5000*j + 1000*k == y) {
                    cnt10000 = i;
                    cnt5000  = j;
                    cnt1000  = k;
                    System.out.println(Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000));
                    System.exit(0);
                }
            }
        }
        System.out.println(Integer.toString(cnt10000) + " " +
                           Integer.toString(cnt5000)  + " " +
                           Integer.toString(cnt1000));
    }
} 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();
        sc.close();

        int cnt10000 = -1;
        int cnt5000  = -1;
        int cnt1000  = -1;
        for(int i=0; i<=n; i++) {
            for(int j=0; j<=n-i; j++) {
                int k = n-i-j;
                if(10000*i + 5000*j + 1000*k == y) {
                    cnt10000 = i;
                    cnt5000  = j;
                    cnt1000  = k;
                    System.out.println(Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000));
                    System.exit(0);
                }
            }
        }
        System.out.println(Integer.toString(cnt10000) + " " +
                           Integer.toString(cnt5000)  + " " +
                           Integer.toString(cnt1000));
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        sc.close();

        int cnt10000 = -1;
        int cnt5000  = -1;
        int cnt1000  = -1;
        for(int i=0; i<=n; i++) {
            for(int j=0; j<=n-i; j++) {
                int k = n-i-j;
                if(10000*i + 5000*j + 1000*k == y) {
                    cnt10000 = i;
                    cnt5000  = j;
                    cnt1000  = k;
                    System.out.println(Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000));
                    System.exit(0);
                }
            }
        }
        System.out.println(Integer.toString(cnt10000) + " " +
                           Integer.toString(cnt5000)  + " " +
                           Integer.toString(cnt1000));
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        sc.close();

        int cnt10000 = -1;
        int cnt5000  = -1;
        int cnt1000  = -1;
        for(int i=0; i<=n; i++) {
            for(int j=0; j<=n-i; j++) {
                int k = n-i-j;
                if(10000*i + 5000*j + 1000*k == y) {
                    cnt10000 = i;
                    cnt5000  = j;
                    cnt1000  = k;
                    System.out.println(Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000));
                    System.exit(0);
                }
            }
        }
        System.out.println(Integer.toString(cnt10000) + " " +
                           Integer.toString(cnt5000)  + " " +
                           Integer.toString(cnt1000));
    } 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 sc.close() sc.close sc int cnt10000 = -1; cnt10000 -1 1 int cnt5000  = -1; cnt5000 -1 1 int cnt1000  = -1; cnt1000 -1 1 for(int i=0; i<=n; i++) {
            for(int j=0; j<=n-i; j++) {
                int k = n-i-j;
                if(10000*i + 5000*j + 1000*k == y) {
                    cnt10000 = i;
                    cnt5000  = j;
                    cnt1000  = k;
                    System.out.println(Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000));
                    System.exit(0);
                }
            }
        } 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;
                if(10000*i + 5000*j + 1000*k == y) {
                    cnt10000 = i;
                    cnt5000  = j;
                    cnt1000  = k;
                    System.out.println(Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000));
                    System.exit(0);
                }
            }
        } {
            for(int j=0; j<=n-i; j++) {
                int k = n-i-j;
                if(10000*i + 5000*j + 1000*k == y) {
                    cnt10000 = i;
                    cnt5000  = j;
                    cnt1000  = k;
                    System.out.println(Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000));
                    System.exit(0);
                }
            }
        } for(int j=0; j<=n-i; j++) {
                int k = n-i-j;
                if(10000*i + 5000*j + 1000*k == y) {
                    cnt10000 = i;
                    cnt5000  = j;
                    cnt1000  = k;
                    System.out.println(Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000));
                    System.exit(0);
                }
            } int j=0; int j=0; j 0 j<=n-i j n-i n i j++ j++ j {
                int k = n-i-j;
                if(10000*i + 5000*j + 1000*k == y) {
                    cnt10000 = i;
                    cnt5000  = j;
                    cnt1000  = k;
                    System.out.println(Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000));
                    System.exit(0);
                }
            } {
                int k = n-i-j;
                if(10000*i + 5000*j + 1000*k == y) {
                    cnt10000 = i;
                    cnt5000  = j;
                    cnt1000  = k;
                    System.out.println(Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000));
                    System.exit(0);
                }
            } int k = n-i-j; k n-i-j n-i-j n i j if(10000*i + 5000*j + 1000*k == y) {
                    cnt10000 = i;
                    cnt5000  = j;
                    cnt1000  = k;
                    System.out.println(Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000));
                    System.exit(0);
                } 10000*i + 5000*j + 1000*k == y 10000*i + 5000*j + 1000*k 10000*i + 5000*j + 1000*k 10000*i 10000 i 5000*j 5000 j 1000*k 1000 k y {
                    cnt10000 = i;
                    cnt5000  = j;
                    cnt1000  = k;
                    System.out.println(Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000));
                    System.exit(0);
                } cnt10000 = i cnt10000 i cnt5000  = j cnt5000 j cnt1000  = k cnt1000 k System.out.println(Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000)) System.out.println System.out System System.out Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000) " " Integer.toString(cnt5000) Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000) Integer.toString(cnt10000) Integer.toString Integer cnt10000 " " Integer.toString(cnt5000) Integer.toString Integer cnt5000 " " Integer.toString(cnt1000) Integer.toString Integer cnt1000 System.exit(0) System.exit System 0 System.out.println(Integer.toString(cnt10000) + " " +
                           Integer.toString(cnt5000)  + " " +
                           Integer.toString(cnt1000)) System.out.println System.out System System.out Integer.toString(cnt10000) + " " +
                           Integer.toString(cnt5000)  + " " +
                           Integer.toString(cnt1000) " " Integer.toString(cnt5000) Integer.toString(cnt10000) + " " +
                           Integer.toString(cnt5000)  + " " +
                           Integer.toString(cnt1000) Integer.toString(cnt10000) Integer.toString Integer cnt10000 " " Integer.toString(cnt5000) Integer.toString Integer cnt5000 " " Integer.toString(cnt1000) Integer.toString Integer cnt1000 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();
        sc.close();

        int cnt10000 = -1;
        int cnt5000  = -1;
        int cnt1000  = -1;
        for(int i=0; i<=n; i++) {
            for(int j=0; j<=n-i; j++) {
                int k = n-i-j;
                if(10000*i + 5000*j + 1000*k == y) {
                    cnt10000 = i;
                    cnt5000  = j;
                    cnt1000  = k;
                    System.out.println(Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000));
                    System.exit(0);
                }
            }
        }
        System.out.println(Integer.toString(cnt10000) + " " +
                           Integer.toString(cnt5000)  + " " +
                           Integer.toString(cnt1000));
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        sc.close();

        int cnt10000 = -1;
        int cnt5000  = -1;
        int cnt1000  = -1;
        for(int i=0; i<=n; i++) {
            for(int j=0; j<=n-i; j++) {
                int k = n-i-j;
                if(10000*i + 5000*j + 1000*k == y) {
                    cnt10000 = i;
                    cnt5000  = j;
                    cnt1000  = k;
                    System.out.println(Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000));
                    System.exit(0);
                }
            }
        }
        System.out.println(Integer.toString(cnt10000) + " " +
                           Integer.toString(cnt5000)  + " " +
                           Integer.toString(cnt1000));
    }
} 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();
        sc.close();

        int cnt10000 = -1;
        int cnt5000  = -1;
        int cnt1000  = -1;
        for(int i=0; i<=n; i++) {
            for(int j=0; j<=n-i; j++) {
                int k = n-i-j;
                if(10000*i + 5000*j + 1000*k == y) {
                    cnt10000 = i;
                    cnt5000  = j;
                    cnt1000  = k;
                    System.out.println(Integer.toString(cnt10000) + " " +
                                       Integer.toString(cnt5000)  + " " +
                                       Integer.toString(cnt1000));
                    System.exit(0);
                }
            }
        }
        System.out.println(Integer.toString(cnt10000) + " " +
                           Integer.toString(cnt5000)  + " " +
                           Integer.toString(cnt1000));
    }
}
