import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int Y = scanner.nextInt();
        scanner.close();
        int z;

        for(int x=0;x<=N;x++) {
            for(int y=0;y<=N;y++) {
                z = N - x - y;
                if(Y == x*10000 + y*5000 + z*1000 && 0 <= z && z <= N) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int Y = scanner.nextInt();
        scanner.close();
        int z;

        for(int x=0;x<=N;x++) {
            for(int y=0;y<=N;y++) {
                z = N - x - y;
                if(Y == x*10000 + y*5000 + z*1000 && 0 <= z && z <= N) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int Y = scanner.nextInt();
        scanner.close();
        int z;

        for(int x=0;x<=N;x++) {
            for(int y=0;y<=N;y++) {
                z = N - x - y;
                if(Y == x*10000 + y*5000 + z*1000 && 0 <= z && z <= N) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
    } main {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int Y = scanner.nextInt();
        scanner.close();
        int z;

        for(int x=0;x<=N;x++) {
            for(int y=0;y<=N;y++) {
                z = N - x - y;
                if(Y == x*10000 + y*5000 + z*1000 && 0 <= z && z <= N) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int Y = scanner.nextInt(); Y scanner.nextInt() scanner.nextInt scanner scanner.close() scanner.close scanner int z; z for(int x=0;x<=N;x++) {
            for(int y=0;y<=N;y++) {
                z = N - x - y;
                if(Y == x*10000 + y*5000 + z*1000 && 0 <= z && z <= N) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        } int x=0; int x=0; x 0 x<=N x N x++ x++ x {
            for(int y=0;y<=N;y++) {
                z = N - x - y;
                if(Y == x*10000 + y*5000 + z*1000 && 0 <= z && z <= N) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        } {
            for(int y=0;y<=N;y++) {
                z = N - x - y;
                if(Y == x*10000 + y*5000 + z*1000 && 0 <= z && z <= N) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        } for(int y=0;y<=N;y++) {
                z = N - x - y;
                if(Y == x*10000 + y*5000 + z*1000 && 0 <= z && z <= N) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            } int y=0; int y=0; y 0 y<=N y N y++ y++ y {
                z = N - x - y;
                if(Y == x*10000 + y*5000 + z*1000 && 0 <= z && z <= N) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            } {
                z = N - x - y;
                if(Y == x*10000 + y*5000 + z*1000 && 0 <= z && z <= N) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            } z = N - x - y z N - x - y N - x - y N x y if(Y == x*10000 + y*5000 + z*1000 && 0 <= z && z <= N) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                } Y == x*10000 + y*5000 + z*1000 && 0 <= z && z <= N Y == x*10000 + y*5000 + z*1000 && 0 <= z && z <= N Y == x*10000 + y*5000 + z*1000 Y x*10000 + y*5000 + z*1000 x*10000 + y*5000 + z*1000 x*10000 x 10000 y*5000 y 5000 z*1000 z 1000 0 <= z 0 z z <= N z N {
                    System.out.println(x + " " + y + " " + z);
                    return;
                } System.out.println(x + " " + y + " " + z) System.out.println System.out System System.out x + " " + y + " " + z " " y x + " " + y + " " + z x " " y " " z return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[] args args
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int Y = scanner.nextInt();
        scanner.close();
        int z;

        for(int x=0;x<=N;x++) {
            for(int y=0;y<=N;y++) {
                z = N - x - y;
                if(Y == x*10000 + y*5000 + z*1000 && 0 <= z && z <= N) {
                    System.out.println(x + " " + y + " " + z);
                    return;
                }
            }
        }

        System.out.println("-1 -1 -1");
    }
}