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 a = -1;
        int b = -1;
        int c = -1;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int k = n - i - j;
                int x = 10000 * i + 5000 * j + 1000 * k; 
                if (x == y) {
                    a = i;
                    b = j;
                    c = k;
                }
            }
        }
        System.out.println(a + " " + b + " " + c);
        sc.close();
    }
} 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 a = -1;
        int b = -1;
        int c = -1;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int k = n - i - j;
                int x = 10000 * i + 5000 * j + 1000 * k; 
                if (x == y) {
                    a = i;
                    b = j;
                    c = k;
                }
            }
        }
        System.out.println(a + " " + b + " " + c);
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        int a = -1;
        int b = -1;
        int c = -1;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int k = n - i - j;
                int x = 10000 * i + 5000 * j + 1000 * k; 
                if (x == y) {
                    a = i;
                    b = j;
                    c = k;
                }
            }
        }
        System.out.println(a + " " + b + " " + c);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        int a = -1;
        int b = -1;
        int c = -1;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int k = n - i - j;
                int x = 10000 * i + 5000 * j + 1000 * k; 
                if (x == y) {
                    a = i;
                    b = j;
                    c = k;
                }
            }
        }
        System.out.println(a + " " + b + " " + c);
        sc.close();
    } 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 a = -1; a -1 1 int b = -1; b -1 1 int c = -1; c -1 1 for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int k = n - i - j;
                int x = 10000 * i + 5000 * j + 1000 * k; 
                if (x == y) {
                    a = i;
                    b = j;
                    c = k;
                }
            }
        } 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;
                int x = 10000 * i + 5000 * j + 1000 * k; 
                if (x == y) {
                    a = i;
                    b = j;
                    c = k;
                }
            }
        } {
            for (int j = 0; j <= n - i; j++) {
                int k = n - i - j;
                int x = 10000 * i + 5000 * j + 1000 * k; 
                if (x == y) {
                    a = i;
                    b = j;
                    c = k;
                }
            }
        } for (int j = 0; j <= n - i; j++) {
                int k = n - i - j;
                int x = 10000 * i + 5000 * j + 1000 * k; 
                if (x == y) {
                    a = i;
                    b = j;
                    c = k;
                }
            } int j = 0; int j = 0; j 0 j <= n - i j n - i n i j++ j++ j {
                int k = n - i - j;
                int x = 10000 * i + 5000 * j + 1000 * k; 
                if (x == y) {
                    a = i;
                    b = j;
                    c = k;
                }
            } {
                int k = n - i - j;
                int x = 10000 * i + 5000 * j + 1000 * k; 
                if (x == y) {
                    a = i;
                    b = j;
                    c = k;
                }
            } int k = n - i - j; k n - i - j n - i - j n i j int x = 10000 * i + 5000 * j + 1000 * k; x 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 (x == y) {
                    a = i;
                    b = j;
                    c = k;
                } x == y x y {
                    a = i;
                    b = j;
                    c = k;
                } a = i a i b = j b j c = k c k System.out.println(a + " " + b + " " + c) System.out.println System.out System System.out a + " " + b + " " + c " " b a + " " + b + " " + c a " " b " " c sc.close() sc.close sc 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 a = -1;
        int b = -1;
        int c = -1;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int k = n - i - j;
                int x = 10000 * i + 5000 * j + 1000 * k; 
                if (x == y) {
                    a = i;
                    b = j;
                    c = k;
                }
            }
        }
        System.out.println(a + " " + b + " " + c);
        sc.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        int a = -1;
        int b = -1;
        int c = -1;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int k = n - i - j;
                int x = 10000 * i + 5000 * j + 1000 * k; 
                if (x == y) {
                    a = i;
                    b = j;
                    c = k;
                }
            }
        }
        System.out.println(a + " " + b + " " + c);
        sc.close();
    }
} 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 a = -1;
        int b = -1;
        int c = -1;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                int k = n - i - j;
                int x = 10000 * i + 5000 * j + 1000 * k; 
                if (x == y) {
                    a = i;
                    b = j;
                    c = k;
                }
            }
        }
        System.out.println(a + " " + b + " " + c);
        sc.close();
    }
}