import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] input = br.readLine().split(" ");
        int N = Integer.parseInt(input[0]);
        long Y = Long.parseLong(input[1]);
        int x = -1;
        int y = -1;
        int z = -1;
        
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N - i; j++){
                if(Y == 10000 * i + 5000 * j + 1000 * (N - (i + j))){
                    x = i;
                    y = j;
                    z = N - (i + j);
                    break;
                }
            }
        }
        
        out.printf("%d %d %d", x, y, z);
        out.close();
        
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
    public static void main(String[] args) throws Exception {
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] input = br.readLine().split(" ");
        int N = Integer.parseInt(input[0]);
        long Y = Long.parseLong(input[1]);
        int x = -1;
        int y = -1;
        int z = -1;
        
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N - i; j++){
                if(Y == 10000 * i + 5000 * j + 1000 * (N - (i + j))){
                    x = i;
                    y = j;
                    z = N - (i + j);
                    break;
                }
            }
        }
        
        out.printf("%d %d %d", x, y, z);
        out.close();
        
    }
} Main public static void main(String[] args) throws Exception {
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] input = br.readLine().split(" ");
        int N = Integer.parseInt(input[0]);
        long Y = Long.parseLong(input[1]);
        int x = -1;
        int y = -1;
        int z = -1;
        
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N - i; j++){
                if(Y == 10000 * i + 5000 * j + 1000 * (N - (i + j))){
                    x = i;
                    y = j;
                    z = N - (i + j);
                    break;
                }
            }
        }
        
        out.printf("%d %d %d", x, y, z);
        out.close();
        
    } main {
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] input = br.readLine().split(" ");
        int N = Integer.parseInt(input[0]);
        long Y = Long.parseLong(input[1]);
        int x = -1;
        int y = -1;
        int z = -1;
        
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N - i; j++){
                if(Y == 10000 * i + 5000 * j + 1000 * (N - (i + j))){
                    x = i;
                    y = j;
                    z = N - (i + j);
                    break;
                }
            }
        }
        
        out.printf("%d %d %d", x, y, z);
        out.close();
        
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); out new PrintWriter(new OutputStreamWriter(System.out)) String[] input = br.readLine().split(" "); input br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int N = Integer.parseInt(input[0]); N Integer.parseInt(input[0]) Integer.parseInt Integer input[0] input 0 long Y = Long.parseLong(input[1]); Y Long.parseLong(input[1]) Long.parseLong Long input[1] input 1 int x = -1; x -1 1 int y = -1; y -1 1 int z = -1; z -1 1 for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N - i; j++){
                if(Y == 10000 * i + 5000 * j + 1000 * (N - (i + j))){
                    x = i;
                    y = j;
                    z = N - (i + j);
                    break;
                }
            }
        } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
            for(int j = 0; j <= N - i; j++){
                if(Y == 10000 * i + 5000 * j + 1000 * (N - (i + j))){
                    x = i;
                    y = j;
                    z = N - (i + j);
                    break;
                }
            }
        } {
            for(int j = 0; j <= N - i; j++){
                if(Y == 10000 * i + 5000 * j + 1000 * (N - (i + j))){
                    x = i;
                    y = j;
                    z = N - (i + j);
                    break;
                }
            }
        } for(int j = 0; j <= N - i; j++){
                if(Y == 10000 * i + 5000 * j + 1000 * (N - (i + j))){
                    x = i;
                    y = j;
                    z = N - (i + j);
                    break;
                }
            } int j = 0; int j = 0; j 0 j <= N - i j N - i N i j++ j++ j {
                if(Y == 10000 * i + 5000 * j + 1000 * (N - (i + j))){
                    x = i;
                    y = j;
                    z = N - (i + j);
                    break;
                }
            } {
                if(Y == 10000 * i + 5000 * j + 1000 * (N - (i + j))){
                    x = i;
                    y = j;
                    z = N - (i + j);
                    break;
                }
            } if(Y == 10000 * i + 5000 * j + 1000 * (N - (i + j))){
                    x = i;
                    y = j;
                    z = N - (i + j);
                    break;
                } Y == 10000 * i + 5000 * j + 1000 * (N - (i + j)) Y 10000 * i + 5000 * j + 1000 * (N - (i + j)) 10000 * i + 5000 * j + 1000 * (N - (i + j)) 10000 * i 10000 i 5000 * j 5000 j 1000 * (N - (i + j)) 1000 (N - (i + j)) N (i + j) i j {
                    x = i;
                    y = j;
                    z = N - (i + j);
                    break;
                } x = i x i y = j y j z = N - (i + j) z N - (i + j) N (i + j) i j break; out.printf("%d %d %d", x, y, z) out.printf out "%d %d %d" x y z out.close() out.close out String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] input = br.readLine().split(" ");
        int N = Integer.parseInt(input[0]);
        long Y = Long.parseLong(input[1]);
        int x = -1;
        int y = -1;
        int z = -1;
        
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N - i; j++){
                if(Y == 10000 * i + 5000 * j + 1000 * (N - (i + j))){
                    x = i;
                    y = j;
                    z = N - (i + j);
                    break;
                }
            }
        }
        
        out.printf("%d %d %d", x, y, z);
        out.close();
        
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] input = br.readLine().split(" ");
        int N = Integer.parseInt(input[0]);
        long Y = Long.parseLong(input[1]);
        int x = -1;
        int y = -1;
        int z = -1;
        
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N - i; j++){
                if(Y == 10000 * i + 5000 * j + 1000 * (N - (i + j))){
                    x = i;
                    y = j;
                    z = N - (i + j);
                    break;
                }
            }
        }
        
        out.printf("%d %d %d", x, y, z);
        out.close();
        
    }
} Main
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] input = br.readLine().split(" ");
        int N = Integer.parseInt(input[0]);
        long Y = Long.parseLong(input[1]);
        int x = -1;
        int y = -1;
        int z = -1;
        
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N - i; j++){
                if(Y == 10000 * i + 5000 * j + 1000 * (N - (i + j))){
                    x = i;
                    y = j;
                    z = N - (i + j);
                    break;
                }
            }
        }
        
        out.printf("%d %d %d", x, y, z);
        out.close();
        
    }
}