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+1; i++) {
            for (int j=0; j<N+1-i; j++) {
                if (10000*i + 5000*j + 1000*(N - i - j) == Y) {
                    System.out.println(i + " " + j + " " + (N - i - j));
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
}
 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+1; i++) {
            for (int j=0; j<N+1-i; j++) {
                if (10000*i + 5000*j + 1000*(N - i - j) == Y) {
                    System.out.println(i + " " + j + " " + (N - i - j));
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
} 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+1; i++) {
            for (int j=0; j<N+1-i; j++) {
                if (10000*i + 5000*j + 1000*(N - i - j) == Y) {
                    System.out.println(i + " " + j + " " + (N - i - j));
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    } main {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int Y = sc.nextInt();

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

