import 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 x = 0;
        int y = 0;
        int z = 0;

        int a = -1;
        int b = -1;
        int c = -1;

        for (x = 0; x <= N; x++) {
            for (y = 0; y <= N - x; y++) {
                if (10000 * x + 5000 * y + 1000 * (N - x - y) == Y) {
                    a = x;
                    b = y;
                    c = N - x - y;
                }
            }
        }

        System.out.println(a + " " + b + " " + c);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int x = 0;
        int y = 0;
        int z = 0;

        int a = -1;
        int b = -1;
        int c = -1;

        for (x = 0; x <= N; x++) {
            for (y = 0; y <= N - x; y++) {
                if (10000 * x + 5000 * y + 1000 * (N - x - y) == Y) {
                    a = x;
                    b = y;
                    c = N - x - y;
                }
            }
        }

        System.out.println(a + " " + b + " " + c);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int x = 0;
        int y = 0;
        int z = 0;

        int a = -1;
        int b = -1;
        int c = -1;

        for (x = 0; x <= N; x++) {
            for (y = 0; y <= N - x; y++) {
                if (10000 * x + 5000 * y + 1000 * (N - x - y) == Y) {
                    a = x;
                    b = y;
                    c = N - x - y;
                }
            }
        }

        System.out.println(a + " " + b + " " + c);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int x = 0;
        int y = 0;
        int z = 0;

        int a = -1;
        int b = -1;
        int c = -1;

        for (x = 0; x <= N; x++) {
            for (y = 0; y <= N - x; y++) {
                if (10000 * x + 5000 * y + 1000 * (N - x - y) == Y) {
                    a = x;
                    b = y;
                    c = N - x - y;
                }
            }
        }

        System.out.println(a + " " + b + " " + c);
    } 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 x = 0; x 0 int y = 0; y 0 int z = 0; z 0 int a = -1; a -1 1 int b = -1; b -1 1 int c = -1; c -1 1 for (x = 0; x <= N; x++) {
            for (y = 0; y <= N - x; y++) {
                if (10000 * x + 5000 * y + 1000 * (N - x - y) == Y) {
                    a = x;
                    b = y;
                    c = N - x - y;
                }
            }
        } x = 0; x = 0 x 0 x <= N x N x++ x++ x {
            for (y = 0; y <= N - x; y++) {
                if (10000 * x + 5000 * y + 1000 * (N - x - y) == Y) {
                    a = x;
                    b = y;
                    c = N - x - y;
                }
            }
        } {
            for (y = 0; y <= N - x; y++) {
                if (10000 * x + 5000 * y + 1000 * (N - x - y) == Y) {
                    a = x;
                    b = y;
                    c = N - x - y;
                }
            }
        } for (y = 0; y <= N - x; y++) {
                if (10000 * x + 5000 * y + 1000 * (N - x - y) == Y) {
                    a = x;
                    b = y;
                    c = N - x - y;
                }
            } y = 0; y = 0 y 0 y <= N - x y N - x N x y++ y++ y {
                if (10000 * x + 5000 * y + 1000 * (N - x - y) == Y) {
                    a = x;
                    b = y;
                    c = N - x - y;
                }
            } {
                if (10000 * x + 5000 * y + 1000 * (N - x - y) == Y) {
                    a = x;
                    b = y;
                    c = N - x - y;
                }
            } if (10000 * x + 5000 * y + 1000 * (N - x - y) == Y) {
                    a = x;
                    b = y;
                    c = N - x - y;
                } 10000 * x + 5000 * y + 1000 * (N - x - y) == Y 10000 * x + 5000 * y + 1000 * (N - x - y) 10000 * x + 5000 * y + 1000 * (N - x - y) 10000 * x 10000 x 5000 * y 5000 y 1000 * (N - x - y) 1000 (N - x - y) N - x - y N x y Y {
                    a = x;
                    b = y;
                    c = N - x - y;
                } a = x a x b = y b y c = N - x - y c N - x - y N - x - y N x y System.out.println(a + " " + b + " " + c) System.out.println System.out System System.out a + " " + b + " " + c " " b a + " " + b + " " + c a " " b " " c 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 x = 0;
        int y = 0;
        int z = 0;

        int a = -1;
        int b = -1;
        int c = -1;

        for (x = 0; x <= N; x++) {
            for (y = 0; y <= N - x; y++) {
                if (10000 * x + 5000 * y + 1000 * (N - x - y) == Y) {
                    a = x;
                    b = y;
                    c = N - x - y;
                }
            }
        }

        System.out.println(a + " " + b + " " + c);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int x = 0;
        int y = 0;
        int z = 0;

        int a = -1;
        int b = -1;
        int c = -1;

        for (x = 0; x <= N; x++) {
            for (y = 0; y <= N - x; y++) {
                if (10000 * x + 5000 * y + 1000 * (N - x - y) == Y) {
                    a = x;
                    b = y;
                    c = N - x - y;
                }
            }
        }

        System.out.println(a + " " + b + " " + c);
    }
} Main
import 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 x = 0;
        int y = 0;
        int z = 0;

        int a = -1;
        int b = -1;
        int c = -1;

        for (x = 0; x <= N; x++) {
            for (y = 0; y <= N - x; y++) {
                if (10000 * x + 5000 * y + 1000 * (N - x - y) == Y) {
                    a = x;
                    b = y;
                    c = N - x - y;
                }
            }
        }

        System.out.println(a + " " + b + " " + c);
    }
}