import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), Y = sc.nextInt(), i = 0, j = 0, k = 0;
		for (i=0; i<=Y/10000; i++) {
			for (j=0; j<=Y/5000; j++) {
				k = (Y-((10000*i)+(5000*j)))/1000;
				if (k>=0 && i+j+k==N) {
					if (((10000*i)+(5000*j)+(1000*k))!=Y) continue;
					System.out.println(i+" "+j+" "+k);
					System.exit(0);
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

} import java.util.*; util.* java public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), Y = sc.nextInt(), i = 0, j = 0, k = 0;
		for (i=0; i<=Y/10000; i++) {
			for (j=0; j<=Y/5000; j++) {
				k = (Y-((10000*i)+(5000*j)))/1000;
				if (k>=0 && i+j+k==N) {
					if (((10000*i)+(5000*j)+(1000*k))!=Y) continue;
					System.out.println(i+" "+j+" "+k);
					System.exit(0);
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

} Main static void solve() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), Y = sc.nextInt(), i = 0, j = 0, k = 0;
		for (i=0; i<=Y/10000; i++) {
			for (j=0; j<=Y/5000; j++) {
				k = (Y-((10000*i)+(5000*j)))/1000;
				if (k>=0 && i+j+k==N) {
					if (((10000*i)+(5000*j)+(1000*k))!=Y) continue;
					System.out.println(i+" "+j+" "+k);
					System.exit(0);
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();		
	} solve {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), Y = sc.nextInt(), i = 0, j = 0, k = 0;
		for (i=0; i<=Y/10000; i++) {
			for (j=0; j<=Y/5000; j++) {
				k = (Y-((10000*i)+(5000*j)))/1000;
				if (k>=0 && i+j+k==N) {
					if (((10000*i)+(5000*j)+(1000*k))!=Y) continue;
					System.out.println(i+" "+j+" "+k);
					System.exit(0);
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt() N sc.nextInt() sc.nextInt sc Y = sc.nextInt() Y sc.nextInt() sc.nextInt sc i = 0 i 0 j = 0 j 0 k = 0; k 0 for (i=0; i<=Y/10000; i++) {
			for (j=0; j<=Y/5000; j++) {
				k = (Y-((10000*i)+(5000*j)))/1000;
				if (k>=0 && i+j+k==N) {
					if (((10000*i)+(5000*j)+(1000*k))!=Y) continue;
					System.out.println(i+" "+j+" "+k);
					System.exit(0);
				}
			}
		} i=0; i=0 i 0 i<=Y/10000 i Y/10000 Y 10000 i++ i++ i {
			for (j=0; j<=Y/5000; j++) {
				k = (Y-((10000*i)+(5000*j)))/1000;
				if (k>=0 && i+j+k==N) {
					if (((10000*i)+(5000*j)+(1000*k))!=Y) continue;
					System.out.println(i+" "+j+" "+k);
					System.exit(0);
				}
			}
		} {
			for (j=0; j<=Y/5000; j++) {
				k = (Y-((10000*i)+(5000*j)))/1000;
				if (k>=0 && i+j+k==N) {
					if (((10000*i)+(5000*j)+(1000*k))!=Y) continue;
					System.out.println(i+" "+j+" "+k);
					System.exit(0);
				}
			}
		} for (j=0; j<=Y/5000; j++) {
				k = (Y-((10000*i)+(5000*j)))/1000;
				if (k>=0 && i+j+k==N) {
					if (((10000*i)+(5000*j)+(1000*k))!=Y) continue;
					System.out.println(i+" "+j+" "+k);
					System.exit(0);
				}
			} j=0; j=0 j 0 j<=Y/5000 j Y/5000 Y 5000 j++ j++ j {
				k = (Y-((10000*i)+(5000*j)))/1000;
				if (k>=0 && i+j+k==N) {
					if (((10000*i)+(5000*j)+(1000*k))!=Y) continue;
					System.out.println(i+" "+j+" "+k);
					System.exit(0);
				}
			} {
				k = (Y-((10000*i)+(5000*j)))/1000;
				if (k>=0 && i+j+k==N) {
					if (((10000*i)+(5000*j)+(1000*k))!=Y) continue;
					System.out.println(i+" "+j+" "+k);
					System.exit(0);
				}
			} k = (Y-((10000*i)+(5000*j)))/1000 k (Y-((10000*i)+(5000*j)))/1000 (Y-((10000*i)+(5000*j))) Y ((10000*i)+(5000*j)) (10000*i) 10000 i (5000*j) 5000 j 1000 if (k>=0 && i+j+k==N) {
					if (((10000*i)+(5000*j)+(1000*k))!=Y) continue;
					System.out.println(i+" "+j+" "+k);
					System.exit(0);
				} k>=0 && i+j+k==N k>=0 k 0 i+j+k==N i+j+k i+j+k i j k N {
					if (((10000*i)+(5000*j)+(1000*k))!=Y) continue;
					System.out.println(i+" "+j+" "+k);
					System.exit(0);
				} if (((10000*i)+(5000*j)+(1000*k))!=Y) continue; ((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 continue; System.out.println(i+" "+j+" "+k) System.out.println System.out System System.out i+" "+j+" "+k " " j i+" "+j+" "+k i " " j " " k System.exit(0) System.exit System 0 System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" sc.close() sc.close sc public static void main(String args[]) {
		solve();
	} main {
		solve();
	} solve() solve String args[] args public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), Y = sc.nextInt(), i = 0, j = 0, k = 0;
		for (i=0; i<=Y/10000; i++) {
			for (j=0; j<=Y/5000; j++) {
				k = (Y-((10000*i)+(5000*j)))/1000;
				if (k>=0 && i+j+k==N) {
					if (((10000*i)+(5000*j)+(1000*k))!=Y) continue;
					System.out.println(i+" "+j+" "+k);
					System.exit(0);
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

} public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), Y = sc.nextInt(), i = 0, j = 0, k = 0;
		for (i=0; i<=Y/10000; i++) {
			for (j=0; j<=Y/5000; j++) {
				k = (Y-((10000*i)+(5000*j)))/1000;
				if (k>=0 && i+j+k==N) {
					if (((10000*i)+(5000*j)+(1000*k))!=Y) continue;
					System.out.println(i+" "+j+" "+k);
					System.exit(0);
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

} Main
import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), Y = sc.nextInt(), i = 0, j = 0, k = 0;
		for (i=0; i<=Y/10000; i++) {
			for (j=0; j<=Y/5000; j++) {
				k = (Y-((10000*i)+(5000*j)))/1000;
				if (k>=0 && i+j+k==N) {
					if (((10000*i)+(5000*j)+(1000*k))!=Y) continue;
					System.out.println(i+" "+j+" "+k);
					System.exit(0);
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

}