import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int N, Y;
        N = scanner.nextInt();
        Y = scanner.nextInt();
        int x =0;
        int y =0;
        int z =0;
        loop: for (int i = 0; i < N+1; i++) {
            for (int j = 0, k = N - i - j; j <= N - i; j++, k--) {
                if (Y == 10000 * i + 5000 * k + 1000 * j) {
                    x = i;
                    y = k;
                    z = j;
                    break loop;
                }else{
                     x = -1;
                     y = -1;
                     z = -1;
                }
            }
        }
        System.out.println(x+" "+y+" "+z);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int N, Y;
        N = scanner.nextInt();
        Y = scanner.nextInt();
        int x =0;
        int y =0;
        int z =0;
        loop: for (int i = 0; i < N+1; i++) {
            for (int j = 0, k = N - i - j; j <= N - i; j++, k--) {
                if (Y == 10000 * i + 5000 * k + 1000 * j) {
                    x = i;
                    y = k;
                    z = j;
                    break loop;
                }else{
                     x = -1;
                     y = -1;
                     z = -1;
                }
            }
        }
        System.out.println(x+" "+y+" "+z);
    }
} Main public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int N, Y;
        N = scanner.nextInt();
        Y = scanner.nextInt();
        int x =0;
        int y =0;
        int z =0;
        loop: for (int i = 0; i < N+1; i++) {
            for (int j = 0, k = N - i - j; j <= N - i; j++, k--) {
                if (Y == 10000 * i + 5000 * k + 1000 * j) {
                    x = i;
                    y = k;
                    z = j;
                    break loop;
                }else{
                     x = -1;
                     y = -1;
                     z = -1;
                }
            }
        }
        System.out.println(x+" "+y+" "+z);
    } main {
        Scanner scanner = new Scanner(System.in);
        int N, Y;
        N = scanner.nextInt();
        Y = scanner.nextInt();
        int x =0;
        int y =0;
        int z =0;
        loop: for (int i = 0; i < N+1; i++) {
            for (int j = 0, k = N - i - j; j <= N - i; j++, k--) {
                if (Y == 10000 * i + 5000 * k + 1000 * j) {
                    x = i;
                    y = k;
                    z = j;
                    break loop;
                }else{
                     x = -1;
                     y = -1;
                     z = -1;
                }
            }
        }
        System.out.println(x+" "+y+" "+z);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N N Y; Y N = scanner.nextInt() N scanner.nextInt() scanner.nextInt scanner Y = scanner.nextInt() Y scanner.nextInt() scanner.nextInt scanner int x =0; x 0 int y =0; y 0 int z =0; z 0 System.out.println(x+" "+y+" "+z) System.out.println System.out System System.out x+" "+y+" "+z " " y x+" "+y+" "+z x " " y " " z String args[] args public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int N, Y;
        N = scanner.nextInt();
        Y = scanner.nextInt();
        int x =0;
        int y =0;
        int z =0;
        loop: for (int i = 0; i < N+1; i++) {
            for (int j = 0, k = N - i - j; j <= N - i; j++, k--) {
                if (Y == 10000 * i + 5000 * k + 1000 * j) {
                    x = i;
                    y = k;
                    z = j;
                    break loop;
                }else{
                     x = -1;
                     y = -1;
                     z = -1;
                }
            }
        }
        System.out.println(x+" "+y+" "+z);
    }
} public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int N, Y;
        N = scanner.nextInt();
        Y = scanner.nextInt();
        int x =0;
        int y =0;
        int z =0;
        loop: for (int i = 0; i < N+1; i++) {
            for (int j = 0, k = N - i - j; j <= N - i; j++, k--) {
                if (Y == 10000 * i + 5000 * k + 1000 * j) {
                    x = i;
                    y = k;
                    z = j;
                    break loop;
                }else{
                     x = -1;
                     y = -1;
                     z = -1;
                }
            }
        }
        System.out.println(x+" "+y+" "+z);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int N, Y;
        N = scanner.nextInt();
        Y = scanner.nextInt();
        int x =0;
        int y =0;
        int z =0;
        loop: for (int i = 0; i < N+1; i++) {
            for (int j = 0, k = N - i - j; j <= N - i; j++, k--) {
                if (Y == 10000 * i + 5000 * k + 1000 * j) {
                    x = i;
                    y = k;
                    z = j;
                    break loop;
                }else{
                     x = -1;
                     y = -1;
                     z = -1;
                }
            }
        }
        System.out.println(x+" "+y+" "+z);
    }
}
