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();
		boolean ans=false;
		int man=0;
		int go=0; 
		int sen = 0;
		int iMax= y/10000;
		a: for(int i=0; i<=iMax; i++) {
			int jMax= (y-i*10000)/5000;
			for(int j=0; j<=jMax; j++) {
					if((y-i*10000-j*5000)/1000 == n-i-j) { ans=true;
					man=i;
					go=j;
					sen=n-i-j;
					break a;}
				}
			}
		if(ans) {
			System.out.println(man +" "+go+" "+sen);
		} else {
			System.out.println(-1+" "+-1+" "+-1);
		}
	}
} 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();
		boolean ans=false;
		int man=0;
		int go=0; 
		int sen = 0;
		int iMax= y/10000;
		a: for(int i=0; i<=iMax; i++) {
			int jMax= (y-i*10000)/5000;
			for(int j=0; j<=jMax; j++) {
					if((y-i*10000-j*5000)/1000 == n-i-j) { ans=true;
					man=i;
					go=j;
					sen=n-i-j;
					break a;}
				}
			}
		if(ans) {
			System.out.println(man +" "+go+" "+sen);
		} else {
			System.out.println(-1+" "+-1+" "+-1);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int y = sc.nextInt();
		boolean ans=false;
		int man=0;
		int go=0; 
		int sen = 0;
		int iMax= y/10000;
		a: for(int i=0; i<=iMax; i++) {
			int jMax= (y-i*10000)/5000;
			for(int j=0; j<=jMax; j++) {
					if((y-i*10000-j*5000)/1000 == n-i-j) { ans=true;
					man=i;
					go=j;
					sen=n-i-j;
					break a;}
				}
			}
		if(ans) {
			System.out.println(man +" "+go+" "+sen);
		} else {
			System.out.println(-1+" "+-1+" "+-1);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int y = sc.nextInt();
		boolean ans=false;
		int man=0;
		int go=0; 
		int sen = 0;
		int iMax= y/10000;
		a: for(int i=0; i<=iMax; i++) {
			int jMax= (y-i*10000)/5000;
			for(int j=0; j<=jMax; j++) {
					if((y-i*10000-j*5000)/1000 == n-i-j) { ans=true;
					man=i;
					go=j;
					sen=n-i-j;
					break a;}
				}
			}
		if(ans) {
			System.out.println(man +" "+go+" "+sen);
		} else {
			System.out.println(-1+" "+-1+" "+-1);
		}
	} 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 boolean ans=false; ans false int man=0; man 0 int go=0; go 0 int sen = 0; sen 0 int iMax= y/10000; iMax y/10000 y 10000 if(ans) {
			System.out.println(man +" "+go+" "+sen);
		} else {
			System.out.println(-1+" "+-1+" "+-1);
		} ans {
			System.out.println(man +" "+go+" "+sen);
		} System.out.println(man +" "+go+" "+sen) System.out.println System.out System System.out man +" "+go+" "+sen " " go man +" "+go+" "+sen man " " go " " sen {
			System.out.println(-1+" "+-1+" "+-1);
		} System.out.println(-1+" "+-1+" "+-1) System.out.println System.out System System.out -1+" "+-1+" "+-1 " " -1 -1+" "+-1+" "+-1 -1 1 " " -1 1 " " -1 1 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();
		boolean ans=false;
		int man=0;
		int go=0; 
		int sen = 0;
		int iMax= y/10000;
		a: for(int i=0; i<=iMax; i++) {
			int jMax= (y-i*10000)/5000;
			for(int j=0; j<=jMax; j++) {
					if((y-i*10000-j*5000)/1000 == n-i-j) { ans=true;
					man=i;
					go=j;
					sen=n-i-j;
					break a;}
				}
			}
		if(ans) {
			System.out.println(man +" "+go+" "+sen);
		} else {
			System.out.println(-1+" "+-1+" "+-1);
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int y = sc.nextInt();
		boolean ans=false;
		int man=0;
		int go=0; 
		int sen = 0;
		int iMax= y/10000;
		a: for(int i=0; i<=iMax; i++) {
			int jMax= (y-i*10000)/5000;
			for(int j=0; j<=jMax; j++) {
					if((y-i*10000-j*5000)/1000 == n-i-j) { ans=true;
					man=i;
					go=j;
					sen=n-i-j;
					break a;}
				}
			}
		if(ans) {
			System.out.println(man +" "+go+" "+sen);
		} else {
			System.out.println(-1+" "+-1+" "+-1);
		}
	}
} Main
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();
		boolean ans=false;
		int man=0;
		int go=0; 
		int sen = 0;
		int iMax= y/10000;
		a: for(int i=0; i<=iMax; i++) {
			int jMax= (y-i*10000)/5000;
			for(int j=0; j<=jMax; j++) {
					if((y-i*10000-j*5000)/1000 == n-i-j) { ans=true;
					man=i;
					go=j;
					sen=n-i-j;
					break a;}
				}
			}
		if(ans) {
			System.out.println(man +" "+go+" "+sen);
		} else {
			System.out.println(-1+" "+-1+" "+-1);
		}
	}
}
