
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}



	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int y=sc.nextInt();

		for(int i=0; i<=n; i++) {
			for(int j=0; j<=n; j++) {
				if(i+j>n)continue;
				int k=n-(i+j);
				if(10000*i + 5000*j + 1000*k == y) {
					System.out.println(i+" "+j+" "+k);
					sc.close();
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();
	}
} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}



	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int y=sc.nextInt();

		for(int i=0; i<=n; i++) {
			for(int j=0; j<=n; j++) {
				if(i+j>n)continue;
				int k=n-(i+j);
				if(10000*i + 5000*j + 1000*k == y) {
					System.out.println(i+" "+j+" "+k);
					sc.close();
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();
	}
} Main public static void main(String[] args) {
		Main main = new Main();
		main.run();
	} main {
		Main main = new Main();
		main.run();
	} Main main = new Main(); main new Main() main.run() main.run main String[] args args public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int y=sc.nextInt();

		for(int i=0; i<=n; i++) {
			for(int j=0; j<=n; j++) {
				if(i+j>n)continue;
				int k=n-(i+j);
				if(10000*i + 5000*j + 1000*k == y) {
					System.out.println(i+" "+j+" "+k);
					sc.close();
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();
	} run {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int y=sc.nextInt();

		for(int i=0; i<=n; i++) {
			for(int j=0; j<=n; j++) {
				if(i+j>n)continue;
				int k=n-(i+j);
				if(10000*i + 5000*j + 1000*k == y) {
					System.out.println(i+" "+j+" "+k);
					sc.close();
					return;
				}
			}
		}
		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 int y=sc.nextInt(); y sc.nextInt() sc.nextInt sc for(int i=0; i<=n; i++) {
			for(int j=0; j<=n; j++) {
				if(i+j>n)continue;
				int k=n-(i+j);
				if(10000*i + 5000*j + 1000*k == y) {
					System.out.println(i+" "+j+" "+k);
					sc.close();
					return;
				}
			}
		} int i=0; int i=0; i 0 i<=n i n i++ i++ i {
			for(int j=0; j<=n; j++) {
				if(i+j>n)continue;
				int k=n-(i+j);
				if(10000*i + 5000*j + 1000*k == y) {
					System.out.println(i+" "+j+" "+k);
					sc.close();
					return;
				}
			}
		} {
			for(int j=0; j<=n; j++) {
				if(i+j>n)continue;
				int k=n-(i+j);
				if(10000*i + 5000*j + 1000*k == y) {
					System.out.println(i+" "+j+" "+k);
					sc.close();
					return;
				}
			}
		} for(int j=0; j<=n; j++) {
				if(i+j>n)continue;
				int k=n-(i+j);
				if(10000*i + 5000*j + 1000*k == y) {
					System.out.println(i+" "+j+" "+k);
					sc.close();
					return;
				}
			} int j=0; int j=0; j 0 j<=n j n j++ j++ j {
				if(i+j>n)continue;
				int k=n-(i+j);
				if(10000*i + 5000*j + 1000*k == y) {
					System.out.println(i+" "+j+" "+k);
					sc.close();
					return;
				}
			} {
				if(i+j>n)continue;
				int k=n-(i+j);
				if(10000*i + 5000*j + 1000*k == y) {
					System.out.println(i+" "+j+" "+k);
					sc.close();
					return;
				}
			} if(i+j>n)continue; i+j>n i+j i j n continue; int k=n-(i+j); k n-(i+j) n (i+j) i j if(10000*i + 5000*j + 1000*k == y) {
					System.out.println(i+" "+j+" "+k);
					sc.close();
					return;
				} 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 {
					System.out.println(i+" "+j+" "+k);
					sc.close();
					return;
				} System.out.println(i+" "+j+" "+k) System.out.println System.out System System.out i+" "+j+" "+k " " j i+" "+j+" "+k i " " j " " k sc.close() sc.close sc return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" sc.close() sc.close sc public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}



	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int y=sc.nextInt();

		for(int i=0; i<=n; i++) {
			for(int j=0; j<=n; j++) {
				if(i+j>n)continue;
				int k=n-(i+j);
				if(10000*i + 5000*j + 1000*k == y) {
					System.out.println(i+" "+j+" "+k);
					sc.close();
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();
	}
} public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}



	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int y=sc.nextInt();

		for(int i=0; i<=n; i++) {
			for(int j=0; j<=n; j++) {
				if(i+j>n)continue;
				int k=n-(i+j);
				if(10000*i + 5000*j + 1000*k == y) {
					System.out.println(i+" "+j+" "+k);
					sc.close();
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();
	}
} Main

import java.util.*;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}



	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int y=sc.nextInt();

		for(int i=0; i<=n; i++) {
			for(int j=0; j<=n; j++) {
				if(i+j>n)continue;
				int k=n-(i+j);
				if(10000*i + 5000*j + 1000*k == y) {
					System.out.println(i+" "+j+" "+k);
					sc.close();
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
		sc.close();
	}
}
