import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		List<int[]> ansList = new ArrayList<>();
		int[] ans = new int[3];
		for (int i = 0; i <= N; i++) {
			for (int j = 0; j <= N-i; j++) {	
				int k = N - i - j;
				if (10000 * i + 5000 * j + 1000 * k == Y && i+j+k == N) {
					ans[0] = i;
					ans[1] = j;
					ans[2] = k;
					ansList.add(ans);
				}				
			}	
		}
		if (ansList.isEmpty()) System.out.println("-1 " +  "-1 " + "-1");
		else {
			ans = ansList.get(0);
			System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		}
	}
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		List<int[]> ansList = new ArrayList<>();
		int[] ans = new int[3];
		for (int i = 0; i <= N; i++) {
			for (int j = 0; j <= N-i; j++) {	
				int k = N - i - j;
				if (10000 * i + 5000 * j + 1000 * k == Y && i+j+k == N) {
					ans[0] = i;
					ans[1] = j;
					ans[2] = k;
					ansList.add(ans);
				}				
			}	
		}
		if (ansList.isEmpty()) System.out.println("-1 " +  "-1 " + "-1");
		else {
			ans = ansList.get(0);
			System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		}
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		List<int[]> ansList = new ArrayList<>();
		int[] ans = new int[3];
		for (int i = 0; i <= N; i++) {
			for (int j = 0; j <= N-i; j++) {	
				int k = N - i - j;
				if (10000 * i + 5000 * j + 1000 * k == Y && i+j+k == N) {
					ans[0] = i;
					ans[1] = j;
					ans[2] = k;
					ansList.add(ans);
				}				
			}	
		}
		if (ansList.isEmpty()) System.out.println("-1 " +  "-1 " + "-1");
		else {
			ans = ansList.get(0);
			System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		List<int[]> ansList = new ArrayList<>();
		int[] ans = new int[3];
		for (int i = 0; i <= N; i++) {
			for (int j = 0; j <= N-i; j++) {	
				int k = N - i - j;
				if (10000 * i + 5000 * j + 1000 * k == Y && i+j+k == N) {
					ans[0] = i;
					ans[1] = j;
					ans[2] = k;
					ansList.add(ans);
				}				
			}	
		}
		if (ansList.isEmpty()) System.out.println("-1 " +  "-1 " + "-1");
		else {
			ans = ansList.get(0);
			System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int Y = sc.nextInt(); Y sc.nextInt() sc.nextInt sc List<int[]> ansList = new ArrayList<>(); ansList new ArrayList<>() int[] ans = new int[3]; ans new int[3] 3 for (int i = 0; i <= N; i++) {
			for (int j = 0; j <= N-i; j++) {	
				int k = N - i - j;
				if (10000 * i + 5000 * j + 1000 * k == Y && i+j+k == N) {
					ans[0] = i;
					ans[1] = j;
					ans[2] = k;
					ansList.add(ans);
				}				
			}	
		} int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
			for (int j = 0; j <= N-i; j++) {	
				int k = N - i - j;
				if (10000 * i + 5000 * j + 1000 * k == Y && i+j+k == N) {
					ans[0] = i;
					ans[1] = j;
					ans[2] = k;
					ansList.add(ans);
				}				
			}	
		} {
			for (int j = 0; j <= N-i; j++) {	
				int k = N - i - j;
				if (10000 * i + 5000 * j + 1000 * k == Y && i+j+k == N) {
					ans[0] = i;
					ans[1] = j;
					ans[2] = k;
					ansList.add(ans);
				}				
			}	
		} for (int j = 0; j <= N-i; j++) {	
				int k = N - i - j;
				if (10000 * i + 5000 * j + 1000 * k == Y && i+j+k == N) {
					ans[0] = i;
					ans[1] = j;
					ans[2] = k;
					ansList.add(ans);
				}				
			} int j = 0; int j = 0; j 0 j <= N-i j N-i N i j++ j++ j {	
				int k = N - i - j;
				if (10000 * i + 5000 * j + 1000 * k == Y && i+j+k == N) {
					ans[0] = i;
					ans[1] = j;
					ans[2] = k;
					ansList.add(ans);
				}				
			} {	
				int k = N - i - j;
				if (10000 * i + 5000 * j + 1000 * k == Y && i+j+k == N) {
					ans[0] = i;
					ans[1] = j;
					ans[2] = k;
					ansList.add(ans);
				}				
			} int k = N - i - j; k N - i - j N - i - j N i j if (10000 * i + 5000 * j + 1000 * k == Y && i+j+k == N) {
					ans[0] = i;
					ans[1] = j;
					ans[2] = k;
					ansList.add(ans);
				} 10000 * i + 5000 * j + 1000 * k == Y && i+j+k == N 10000 * i + 5000 * j + 1000 * k == Y 10000 * i + 5000 * j + 1000 * k 10000 * i + 5000 * j + 1000 * k 10000 * i 10000 i 5000 * j 5000 j 1000 * k 1000 k Y i+j+k == N i+j+k i+j+k i j k N {
					ans[0] = i;
					ans[1] = j;
					ans[2] = k;
					ansList.add(ans);
				} ans[0] = i ans[0] ans 0 i ans[1] = j ans[1] ans 1 j ans[2] = k ans[2] ans 2 k ansList.add(ans) ansList.add ansList ans if (ansList.isEmpty()) System.out.println("-1 " +  "-1 " + "-1");
		else {
			ans = ansList.get(0);
			System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		} ansList.isEmpty() ansList.isEmpty ansList System.out.println("-1 " +  "-1 " + "-1") System.out.println System.out System System.out "-1 " +  "-1 " + "-1" "-1 " +  "-1 " + "-1" "-1 " "-1 " "-1" {
			ans = ansList.get(0);
			System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		} ans = ansList.get(0) ans ansList.get(0) ansList.get ansList 0 System.out.println(ans[0] + " " + ans[1] + " " + ans[2]) System.out.println System.out System System.out ans[0] + " " + ans[1] + " " + ans[2] " " ans[1] ans[0] + " " + ans[1] + " " + ans[2] ans[0] ans 0 " " ans[1] ans 1 " " ans[2] ans 2 String[] args args public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		List<int[]> ansList = new ArrayList<>();
		int[] ans = new int[3];
		for (int i = 0; i <= N; i++) {
			for (int j = 0; j <= N-i; j++) {	
				int k = N - i - j;
				if (10000 * i + 5000 * j + 1000 * k == Y && i+j+k == N) {
					ans[0] = i;
					ans[1] = j;
					ans[2] = k;
					ansList.add(ans);
				}				
			}	
		}
		if (ansList.isEmpty()) System.out.println("-1 " +  "-1 " + "-1");
		else {
			ans = ansList.get(0);
			System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		}
	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		List<int[]> ansList = new ArrayList<>();
		int[] ans = new int[3];
		for (int i = 0; i <= N; i++) {
			for (int j = 0; j <= N-i; j++) {	
				int k = N - i - j;
				if (10000 * i + 5000 * j + 1000 * k == Y && i+j+k == N) {
					ans[0] = i;
					ans[1] = j;
					ans[2] = k;
					ansList.add(ans);
				}				
			}	
		}
		if (ansList.isEmpty()) System.out.println("-1 " +  "-1 " + "-1");
		else {
			ans = ansList.get(0);
			System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		}
	}
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		List<int[]> ansList = new ArrayList<>();
		int[] ans = new int[3];
		for (int i = 0; i <= N; i++) {
			for (int j = 0; j <= N-i; j++) {	
				int k = N - i - j;
				if (10000 * i + 5000 * j + 1000 * k == Y && i+j+k == N) {
					ans[0] = i;
					ans[1] = j;
					ans[2] = k;
					ansList.add(ans);
				}				
			}	
		}
		if (ansList.isEmpty()) System.out.println("-1 " +  "-1 " + "-1");
		else {
			ans = ansList.get(0);
			System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);
		}
	}
}