import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] s = scanner.nextLine().split(" ");
        int n = Integer.parseInt(s[0]);
        int y = Integer.parseInt(s[1]);
        int maxX = y / 10000;
        boolean success = false;
out:
        for (int X = 0; X <= maxX; X++) {
            int rest = y - X * 10000;
            int minY = 0;
            if (X + rest / 1000 > n) {
                minY = (rest - (n - X) * 1000) / 5000;
            }
            int maxY = (y - X * 10000) / 5000;
            for (int Y = minY; Y <= maxY; Y++) {
                int Z = (y - X * 10000 - Y * 5000) / 1000;
                if (y == X * 10000 + Y * 5000 + Z * 1000) {
                    if (n == X + Y + Z) {
                        System.out.println(X + " " + Y + " " + Z);
                        success = true;
                        break out;
                    }
                }
            }
        }
        if (!success) {
            System.out.println("-1 -1 -1");
        }
        scanner.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] s = scanner.nextLine().split(" ");
        int n = Integer.parseInt(s[0]);
        int y = Integer.parseInt(s[1]);
        int maxX = y / 10000;
        boolean success = false;
out:
        for (int X = 0; X <= maxX; X++) {
            int rest = y - X * 10000;
            int minY = 0;
            if (X + rest / 1000 > n) {
                minY = (rest - (n - X) * 1000) / 5000;
            }
            int maxY = (y - X * 10000) / 5000;
            for (int Y = minY; Y <= maxY; Y++) {
                int Z = (y - X * 10000 - Y * 5000) / 1000;
                if (y == X * 10000 + Y * 5000 + Z * 1000) {
                    if (n == X + Y + Z) {
                        System.out.println(X + " " + Y + " " + Z);
                        success = true;
                        break out;
                    }
                }
            }
        }
        if (!success) {
            System.out.println("-1 -1 -1");
        }
        scanner.close();
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] s = scanner.nextLine().split(" ");
        int n = Integer.parseInt(s[0]);
        int y = Integer.parseInt(s[1]);
        int maxX = y / 10000;
        boolean success = false;
out:
        for (int X = 0; X <= maxX; X++) {
            int rest = y - X * 10000;
            int minY = 0;
            if (X + rest / 1000 > n) {
                minY = (rest - (n - X) * 1000) / 5000;
            }
            int maxY = (y - X * 10000) / 5000;
            for (int Y = minY; Y <= maxY; Y++) {
                int Z = (y - X * 10000 - Y * 5000) / 1000;
                if (y == X * 10000 + Y * 5000 + Z * 1000) {
                    if (n == X + Y + Z) {
                        System.out.println(X + " " + Y + " " + Z);
                        success = true;
                        break out;
                    }
                }
            }
        }
        if (!success) {
            System.out.println("-1 -1 -1");
        }
        scanner.close();
    } main {
        Scanner scanner = new Scanner(System.in);
        String[] s = scanner.nextLine().split(" ");
        int n = Integer.parseInt(s[0]);
        int y = Integer.parseInt(s[1]);
        int maxX = y / 10000;
        boolean success = false;
out:
        for (int X = 0; X <= maxX; X++) {
            int rest = y - X * 10000;
            int minY = 0;
            if (X + rest / 1000 > n) {
                minY = (rest - (n - X) * 1000) / 5000;
            }
            int maxY = (y - X * 10000) / 5000;
            for (int Y = minY; Y <= maxY; Y++) {
                int Z = (y - X * 10000 - Y * 5000) / 1000;
                if (y == X * 10000 + Y * 5000 + Z * 1000) {
                    if (n == X + Y + Z) {
                        System.out.println(X + " " + Y + " " + Z);
                        success = true;
                        break out;
                    }
                }
            }
        }
        if (!success) {
            System.out.println("-1 -1 -1");
        }
        scanner.close();
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String[] s = scanner.nextLine().split(" "); s scanner.nextLine().split(" ") scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " int n = Integer.parseInt(s[0]); n Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 int y = Integer.parseInt(s[1]); y Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 int maxX = y / 10000; maxX y / 10000 y 10000 boolean success = false; success false if (!success) {
            System.out.println("-1 -1 -1");
        } !success success {
            System.out.println("-1 -1 -1");
        } System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" scanner.close() scanner.close scanner String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] s = scanner.nextLine().split(" ");
        int n = Integer.parseInt(s[0]);
        int y = Integer.parseInt(s[1]);
        int maxX = y / 10000;
        boolean success = false;
out:
        for (int X = 0; X <= maxX; X++) {
            int rest = y - X * 10000;
            int minY = 0;
            if (X + rest / 1000 > n) {
                minY = (rest - (n - X) * 1000) / 5000;
            }
            int maxY = (y - X * 10000) / 5000;
            for (int Y = minY; Y <= maxY; Y++) {
                int Z = (y - X * 10000 - Y * 5000) / 1000;
                if (y == X * 10000 + Y * 5000 + Z * 1000) {
                    if (n == X + Y + Z) {
                        System.out.println(X + " " + Y + " " + Z);
                        success = true;
                        break out;
                    }
                }
            }
        }
        if (!success) {
            System.out.println("-1 -1 -1");
        }
        scanner.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] s = scanner.nextLine().split(" ");
        int n = Integer.parseInt(s[0]);
        int y = Integer.parseInt(s[1]);
        int maxX = y / 10000;
        boolean success = false;
out:
        for (int X = 0; X <= maxX; X++) {
            int rest = y - X * 10000;
            int minY = 0;
            if (X + rest / 1000 > n) {
                minY = (rest - (n - X) * 1000) / 5000;
            }
            int maxY = (y - X * 10000) / 5000;
            for (int Y = minY; Y <= maxY; Y++) {
                int Z = (y - X * 10000 - Y * 5000) / 1000;
                if (y == X * 10000 + Y * 5000 + Z * 1000) {
                    if (n == X + Y + Z) {
                        System.out.println(X + " " + Y + " " + Z);
                        success = true;
                        break out;
                    }
                }
            }
        }
        if (!success) {
            System.out.println("-1 -1 -1");
        }
        scanner.close();
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] s = scanner.nextLine().split(" ");
        int n = Integer.parseInt(s[0]);
        int y = Integer.parseInt(s[1]);
        int maxX = y / 10000;
        boolean success = false;
out:
        for (int X = 0; X <= maxX; X++) {
            int rest = y - X * 10000;
            int minY = 0;
            if (X + rest / 1000 > n) {
                minY = (rest - (n - X) * 1000) / 5000;
            }
            int maxY = (y - X * 10000) / 5000;
            for (int Y = minY; Y <= maxY; Y++) {
                int Z = (y - X * 10000 - Y * 5000) / 1000;
                if (y == X * 10000 + Y * 5000 + Z * 1000) {
                    if (n == X + Y + Z) {
                        System.out.println(X + " " + Y + " " + Z);
                        success = true;
                        break out;
                    }
                }
            }
        }
        if (!success) {
            System.out.println("-1 -1 -1");
        }
        scanner.close();
    }
}
