import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.util.Comparator.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==================================================================
    public void solve() {
    	int N = ni();
    	int Y = ni();
    	for (int i = 0; i <= N; i++) {
    		for (int j = 0; j <= N; j++) {
				if((N-i-j) >= 0 &&
					(Y - i*10000 - 5000*j - (N-i-j)*1000) == 0) {
					out.println(i + " " + j + " " + (N-i-j));
					return;
				}
			}
		}
    	out.println("-1 -1 -1");
    }
    // ------------------------------------------
    // 入力
    // ------------------------------------------
    public int ni() {
    	return Integer.parseInt(sc.next());
    }
    public long nl() {
    	return Long.parseLong(sc.next());
    }
    public String ns() {
    	return sc.next();
    }
    public char[] nc() {
    	return sc.next().toCharArray();
    }
    public int[] ndi(int N) {
    	int[] ans = new int[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ni();
		}
    	return ans;
    }
    public long[] ndl(int N) {
    	long[] ans = new long[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = nl();
		}
    	return ans;
    }
    public String[] nds(int N) {
    	String[] ans = new String[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ns();
		}
    	return ans;
    }
    public char[][] ndc(int N) {
    	char[][] ans = new char[N][];
    	for (int i = 0; i < N; i++) {
			ans[i] = nc();
		}
    	return ans;
    }
    public int[][] ndii(int N, int S) {
    	int[][] ans = new int[N][S];
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		}
    	return ans;
    }
} import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.lang.reflect.Array; Array java.lang.reflect import java.math.BigDecimal; BigDecimal java.math import java.math.MathContext; MathContext java.math import java.util.ArrayDeque; ArrayDeque java.util import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator java.util import java.util.HashMap; HashMap java.util import java.util.HashSet; HashSet java.util import java.util.Iterator; Iterator java.util import java.util.List; List java.util import java.util.Map; Map java.util import java.util.Map.Entry; Entry java.util.Map import java.util.PriorityQueue; PriorityQueue java.util import java.util.Queue; Queue java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util import java.util.Stack; Stack java.util import java.util.TreeMap; TreeMap java.util import java.util.TreeSet; TreeSet java.util import static java.util.Comparator.*; import static java.util.Comparator.*; import static java.util.Comparator.*; public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
} Main public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    } main {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    } PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) Solver solver = new Solver(System.in, out); solver new Solver(System.in, out) solver.solve() solver.solve solver out.close() out.close out String[] args args class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==================================================================
    public void solve() {
    	int N = ni();
    	int Y = ni();
    	for (int i = 0; i <= N; i++) {
    		for (int j = 0; j <= N; j++) {
				if((N-i-j) >= 0 &&
					(Y - i*10000 - 5000*j - (N-i-j)*1000) == 0) {
					out.println(i + " " + j + " " + (N-i-j));
					return;
				}
			}
		}
    	out.println("-1 -1 -1");
    }
    // ------------------------------------------
    // 入力
    // ------------------------------------------
    public int ni() {
    	return Integer.parseInt(sc.next());
    }
    public long nl() {
    	return Long.parseLong(sc.next());
    }
    public String ns() {
    	return sc.next();
    }
    public char[] nc() {
    	return sc.next().toCharArray();
    }
    public int[] ndi(int N) {
    	int[] ans = new int[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ni();
		}
    	return ans;
    }
    public long[] ndl(int N) {
    	long[] ans = new long[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = nl();
		}
    	return ans;
    }
    public String[] nds(int N) {
    	String[] ans = new String[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ns();
		}
    	return ans;
    }
    public char[][] ndc(int N) {
    	char[][] ans = new char[N][];
    	for (int i = 0; i < N; i++) {
			ans[i] = nc();
		}
    	return ans;
    }
    public int[][] ndii(int N, int S) {
    	int[][] ans = new int[N][S];
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		}
    	return ans;
    }
} Solver Scanner sc; sc PrintWriter out; out public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    } Solver {
    	sc = new Scanner(in);
    	this.out = out;
    } sc = new Scanner(in) sc new Scanner(in) this.out = out this.out this this.out out InputStream in in PrintWriter out out // ==================================================================
    public void solve() {
    	int N = ni();
    	int Y = ni();
    	for (int i = 0; i <= N; i++) {
    		for (int j = 0; j <= N; j++) {
				if((N-i-j) >= 0 &&
					(Y - i*10000 - 5000*j - (N-i-j)*1000) == 0) {
					out.println(i + " " + j + " " + (N-i-j));
					return;
				}
			}
		}
    	out.println("-1 -1 -1");
    } solve {
    	int N = ni();
    	int Y = ni();
    	for (int i = 0; i <= N; i++) {
    		for (int j = 0; j <= N; j++) {
				if((N-i-j) >= 0 &&
					(Y - i*10000 - 5000*j - (N-i-j)*1000) == 0) {
					out.println(i + " " + j + " " + (N-i-j));
					return;
				}
			}
		}
    	out.println("-1 -1 -1");
    } int N = ni(); N ni() ni int Y = ni(); Y ni() ni for (int i = 0; i <= N; i++) {
    		for (int j = 0; j <= N; j++) {
				if((N-i-j) >= 0 &&
					(Y - i*10000 - 5000*j - (N-i-j)*1000) == 0) {
					out.println(i + " " + j + " " + (N-i-j));
					return;
				}
			}
		} int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
    		for (int j = 0; j <= N; j++) {
				if((N-i-j) >= 0 &&
					(Y - i*10000 - 5000*j - (N-i-j)*1000) == 0) {
					out.println(i + " " + j + " " + (N-i-j));
					return;
				}
			}
		} {
    		for (int j = 0; j <= N; j++) {
				if((N-i-j) >= 0 &&
					(Y - i*10000 - 5000*j - (N-i-j)*1000) == 0) {
					out.println(i + " " + j + " " + (N-i-j));
					return;
				}
			}
		} for (int j = 0; j <= N; j++) {
				if((N-i-j) >= 0 &&
					(Y - i*10000 - 5000*j - (N-i-j)*1000) == 0) {
					out.println(i + " " + j + " " + (N-i-j));
					return;
				}
			} int j = 0; int j = 0; j 0 j <= N j N j++ j++ j {
				if((N-i-j) >= 0 &&
					(Y - i*10000 - 5000*j - (N-i-j)*1000) == 0) {
					out.println(i + " " + j + " " + (N-i-j));
					return;
				}
			} {
				if((N-i-j) >= 0 &&
					(Y - i*10000 - 5000*j - (N-i-j)*1000) == 0) {
					out.println(i + " " + j + " " + (N-i-j));
					return;
				}
			} if((N-i-j) >= 0 &&
					(Y - i*10000 - 5000*j - (N-i-j)*1000) == 0) {
					out.println(i + " " + j + " " + (N-i-j));
					return;
				} (N-i-j) >= 0 &&
					(Y - i*10000 - 5000*j - (N-i-j)*1000) == 0 (N-i-j) >= 0 (N-i-j) N-i-j N i j 0 (Y - i*10000 - 5000*j - (N-i-j)*1000) == 0 (Y - i*10000 - 5000*j - (N-i-j)*1000) 5000*j Y - i*10000 - 5000*j - (N-i-j)*1000 Y i*10000 i 10000 5000*j 5000 j (N-i-j)*1000 (N-i-j) N-i-j N i j 1000 0 {
					out.println(i + " " + j + " " + (N-i-j));
					return;
				} out.println(i + " " + j + " " + (N-i-j)) out.println out i + " " + j + " " + (N-i-j) " " j i + " " + j + " " + (N-i-j) i " " j " " (N-i-j) N-i-j N i j return; out.println("-1 -1 -1") out.println out "-1 -1 -1" // ------------------------------------------
    // 入力
    // ------------------------------------------
    public int ni() {
    	return Integer.parseInt(sc.next());
    } ni {
    	return Integer.parseInt(sc.next());
    } return Integer.parseInt(sc.next()); Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc public long nl() {
    	return Long.parseLong(sc.next());
    } nl {
    	return Long.parseLong(sc.next());
    } return Long.parseLong(sc.next()); Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc public String ns() {
    	return sc.next();
    } ns {
    	return sc.next();
    } return sc.next(); sc.next() sc.next sc public char[] nc() {
    	return sc.next().toCharArray();
    } nc {
    	return sc.next().toCharArray();
    } return sc.next().toCharArray(); sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc public int[] ndi(int N) {
    	int[] ans = new int[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ni();
		}
    	return ans;
    } ndi {
    	int[] ans = new int[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ni();
		}
    	return ans;
    } int[] ans = new int[N]; ans new int[N] N for (int i = 0; i < N; i++) {
			ans[i] = ni();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			ans[i] = ni();
		} {
			ans[i] = ni();
		} ans[i] = ni() ans[i] ans i ni() ni return ans; ans int N N public long[] ndl(int N) {
    	long[] ans = new long[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = nl();
		}
    	return ans;
    } ndl {
    	long[] ans = new long[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = nl();
		}
    	return ans;
    } long[] ans = new long[N]; ans new long[N] N for (int i = 0; i < N; i++) {
			ans[i] = nl();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			ans[i] = nl();
		} {
			ans[i] = nl();
		} ans[i] = nl() ans[i] ans i nl() nl return ans; ans int N N public String[] nds(int N) {
    	String[] ans = new String[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ns();
		}
    	return ans;
    } nds {
    	String[] ans = new String[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ns();
		}
    	return ans;
    } String[] ans = new String[N]; ans new String[N] N for (int i = 0; i < N; i++) {
			ans[i] = ns();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			ans[i] = ns();
		} {
			ans[i] = ns();
		} ans[i] = ns() ans[i] ans i ns() ns return ans; ans int N N public char[][] ndc(int N) {
    	char[][] ans = new char[N][];
    	for (int i = 0; i < N; i++) {
			ans[i] = nc();
		}
    	return ans;
    } ndc {
    	char[][] ans = new char[N][];
    	for (int i = 0; i < N; i++) {
			ans[i] = nc();
		}
    	return ans;
    } char[][] ans = new char[N][]; ans new char[N][] N for (int i = 0; i < N; i++) {
			ans[i] = nc();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			ans[i] = nc();
		} {
			ans[i] = nc();
		} ans[i] = nc() ans[i] ans i nc() nc return ans; ans int N N public int[][] ndii(int N, int S) {
    	int[][] ans = new int[N][S];
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		}
    	return ans;
    } ndii {
    	int[][] ans = new int[N][S];
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		}
    	return ans;
    } int[][] ans = new int[N][S]; ans new int[N][S] N S for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		} {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		} for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			} int j = 0; int j = 0; j 0 j < S j S j++ j++ j {
				ans[i][j] = ni();
			} {
				ans[i][j] = ni();
			} ans[i][j] = ni() ans[i][j] ans[i] ans i j ni() ni return ans; ans int N N int S S public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
} public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
} Main
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.util.Comparator.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==================================================================
    public void solve() {
    	int N = ni();
    	int Y = ni();
    	for (int i = 0; i <= N; i++) {
    		for (int j = 0; j <= N; j++) {
				if((N-i-j) >= 0 &&
					(Y - i*10000 - 5000*j - (N-i-j)*1000) == 0) {
					out.println(i + " " + j + " " + (N-i-j));
					return;
				}
			}
		}
    	out.println("-1 -1 -1");
    }
    // ------------------------------------------
    // 入力
    // ------------------------------------------
    public int ni() {
    	return Integer.parseInt(sc.next());
    }
    public long nl() {
    	return Long.parseLong(sc.next());
    }
    public String ns() {
    	return sc.next();
    }
    public char[] nc() {
    	return sc.next().toCharArray();
    }
    public int[] ndi(int N) {
    	int[] ans = new int[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ni();
		}
    	return ans;
    }
    public long[] ndl(int N) {
    	long[] ans = new long[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = nl();
		}
    	return ans;
    }
    public String[] nds(int N) {
    	String[] ans = new String[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ns();
		}
    	return ans;
    }
    public char[][] ndc(int N) {
    	char[][] ans = new char[N][];
    	for (int i = 0; i < N; i++) {
			ans[i] = nc();
		}
    	return ans;
    }
    public int[][] ndii(int N, int S) {
    	int[][] ans = new int[N][S];
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		}
    	return ans;
    }
}
