import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
    	int N, Y;
    	
        void solve(InputReader in, PrintWriter out) {
        	N = in.nextInt();
        	Y = in.nextInt();
        	
        	for (int x = 0; x <= N; ++x) {
        		for (int y = 0; y <= N - x; ++y) {
        			int z = N - (x + y);
        			if (10000*x + 5000*y + 1000*z == Y) {
        				out.println(String.format("%d %d %d", x, y, z));
        				return;
        			}
        		}
        	}
        			
        	out.println("-1 -1 -1");
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.OutputStream; OutputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
    	int N, Y;
    	
        void solve(InputReader in, PrintWriter out) {
        	N = in.nextInt();
        	Y = in.nextInt();
        	
        	for (int x = 0; x <= N; ++x) {
        		for (int y = 0; y <= N - x; ++y) {
        			int z = N - (x + y);
        			if (10000*x + 5000*y + 1000*z == Y) {
        				out.println(String.format("%d %d %d", x, y, z));
        				return;
        			}
        		}
        	}
        			
        	out.println("-1 -1 -1");
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out InputReader in = new InputReader(inputStream); in new InputReader(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) Task solver = new Task(); solver new Task() solver.solve(in, out) solver.solve solver in out out.close() out.close out String[] args args static class Task {
    	int N, Y;
    	
        void solve(InputReader in, PrintWriter out) {
        	N = in.nextInt();
        	Y = in.nextInt();
        	
        	for (int x = 0; x <= N; ++x) {
        		for (int y = 0; y <= N - x; ++y) {
        			int z = N - (x + y);
        			if (10000*x + 5000*y + 1000*z == Y) {
        				out.println(String.format("%d %d %d", x, y, z));
        				return;
        			}
        		}
        	}
        			
        	out.println("-1 -1 -1");
        }
    } Task int N N Y; Y void solve(InputReader in, PrintWriter out) {
        	N = in.nextInt();
        	Y = in.nextInt();
        	
        	for (int x = 0; x <= N; ++x) {
        		for (int y = 0; y <= N - x; ++y) {
        			int z = N - (x + y);
        			if (10000*x + 5000*y + 1000*z == Y) {
        				out.println(String.format("%d %d %d", x, y, z));
        				return;
        			}
        		}
        	}
        			
        	out.println("-1 -1 -1");
        } solve {
        	N = in.nextInt();
        	Y = in.nextInt();
        	
        	for (int x = 0; x <= N; ++x) {
        		for (int y = 0; y <= N - x; ++y) {
        			int z = N - (x + y);
        			if (10000*x + 5000*y + 1000*z == Y) {
        				out.println(String.format("%d %d %d", x, y, z));
        				return;
        			}
        		}
        	}
        			
        	out.println("-1 -1 -1");
        } N = in.nextInt() N in.nextInt() in.nextInt in Y = in.nextInt() Y in.nextInt() in.nextInt in for (int x = 0; x <= N; ++x) {
        		for (int y = 0; y <= N - x; ++y) {
        			int z = N - (x + y);
        			if (10000*x + 5000*y + 1000*z == Y) {
        				out.println(String.format("%d %d %d", 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 - x; ++y) {
        			int z = N - (x + y);
        			if (10000*x + 5000*y + 1000*z == Y) {
        				out.println(String.format("%d %d %d", x, y, z));
        				return;
        			}
        		}
        	} {
        		for (int y = 0; y <= N - x; ++y) {
        			int z = N - (x + y);
        			if (10000*x + 5000*y + 1000*z == Y) {
        				out.println(String.format("%d %d %d", x, y, z));
        				return;
        			}
        		}
        	} for (int y = 0; y <= N - x; ++y) {
        			int z = N - (x + y);
        			if (10000*x + 5000*y + 1000*z == Y) {
        				out.println(String.format("%d %d %d", x, y, z));
        				return;
        			}
        		} int y = 0; int y = 0; y 0 y <= N - x y N - x N x ++y ++y y {
        			int z = N - (x + y);
        			if (10000*x + 5000*y + 1000*z == Y) {
        				out.println(String.format("%d %d %d", x, y, z));
        				return;
        			}
        		} {
        			int z = N - (x + y);
        			if (10000*x + 5000*y + 1000*z == Y) {
        				out.println(String.format("%d %d %d", x, y, z));
        				return;
        			}
        		} int z = N - (x + y); z N - (x + y) N (x + y) x y if (10000*x + 5000*y + 1000*z == Y) {
        				out.println(String.format("%d %d %d", x, y, z));
        				return;
        			} 10000*x + 5000*y + 1000*z == Y 10000*x + 5000*y + 1000*z 10000*x + 5000*y + 1000*z 10000*x 10000 x 5000*y 5000 y 1000*z 1000 z Y {
        				out.println(String.format("%d %d %d", x, y, z));
        				return;
        			} out.println(String.format("%d %d %d", x, y, z)) out.println out String.format("%d %d %d", x, y, z) String.format String "%d %d %d" x y z return; out.println("-1 -1 -1") out.println out "-1 -1 -1" InputReader in in PrintWriter out out static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    } InputReader BufferedReader reader; reader StringTokenizer tokenizer; tokenizer InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        } InputReader {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        } reader = new BufferedReader(new InputStreamReader(stream)) reader new BufferedReader(new InputStreamReader(stream)) tokenizer = null tokenizer null InputStream stream stream String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        } next {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        } while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } tokenizer == null || !tokenizer.hasMoreTokens() tokenizer == null tokenizer null !tokenizer.hasMoreTokens() tokenizer.hasMoreTokens() tokenizer.hasMoreTokens tokenizer {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } IOException e {
                    throw new RuntimeException(e);
                } throw new RuntimeException(e); new RuntimeException(e) {
                    tokenizer = new StringTokenizer(reader.readLine());
                } tokenizer = new StringTokenizer(reader.readLine()) tokenizer new StringTokenizer(reader.readLine()) return tokenizer.nextToken(); tokenizer.nextToken() tokenizer.nextToken tokenizer int nextInt() {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        } nextIntArray {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        } int[] arr = new int[size]; arr new int[size] size for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
                arr[i] = nextInt();
            } {
                arr[i] = nextInt();
            } arr[i] = nextInt() arr[i] arr i nextInt() nextInt return arr; arr int size size long nextLong() {
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        } nextLongArray {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        } long[] arr = new long[size]; arr new long[size] size for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
                arr[i] = nextLong();
            } {
                arr[i] = nextLong();
            } arr[i] = nextLong() arr[i] arr i nextLong() nextLong return arr; arr int size size public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
    	int N, Y;
    	
        void solve(InputReader in, PrintWriter out) {
        	N = in.nextInt();
        	Y = in.nextInt();
        	
        	for (int x = 0; x <= N; ++x) {
        		for (int y = 0; y <= N - x; ++y) {
        			int z = N - (x + y);
        			if (10000*x + 5000*y + 1000*z == Y) {
        				out.println(String.format("%d %d %d", x, y, z));
        				return;
        			}
        		}
        	}
        			
        	out.println("-1 -1 -1");
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
    	int N, Y;
    	
        void solve(InputReader in, PrintWriter out) {
        	N = in.nextInt();
        	Y = in.nextInt();
        	
        	for (int x = 0; x <= N; ++x) {
        		for (int y = 0; y <= N - x; ++y) {
        			int z = N - (x + y);
        			if (10000*x + 5000*y + 1000*z == Y) {
        				out.println(String.format("%d %d %d", x, y, z));
        				return;
        			}
        		}
        	}
        			
        	out.println("-1 -1 -1");
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
    	int N, Y;
    	
        void solve(InputReader in, PrintWriter out) {
        	N = in.nextInt();
        	Y = in.nextInt();
        	
        	for (int x = 0; x <= N; ++x) {
        		for (int y = 0; y <= N - x; ++y) {
        			int z = N - (x + y);
        			if (10000*x + 5000*y + 1000*z == Y) {
        				out.println(String.format("%d %d %d", x, y, z));
        				return;
        			}
        		}
        	}
        			
        	out.println("-1 -1 -1");
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}
