import java.util.Scanner;

public class Main {

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int yen = sc.nextInt();
		int fukuzawa = -1;
		int higuchi = -1;
		int noguchi = -1;

		for(int i = 0;i <= n;i++) {
			if(i * 10000 > yen) {
				break;
			}
			for(int j = 0;j <= n-i;j++) {
				if(10000 * i + 5000 * j > yen) {
					break;
				}
				if((yen - (10000 * i + 5000 * j)) % 1000 == 0
						&& (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j ) {
					fukuzawa = i;
					higuchi = j;
					noguchi = n-i-j;
					break;
				}
			}
		}
		System.out.println(fukuzawa + " "+ higuchi +" " + noguchi);
	}
} 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 yen = sc.nextInt();
		int fukuzawa = -1;
		int higuchi = -1;
		int noguchi = -1;

		for(int i = 0;i <= n;i++) {
			if(i * 10000 > yen) {
				break;
			}
			for(int j = 0;j <= n-i;j++) {
				if(10000 * i + 5000 * j > yen) {
					break;
				}
				if((yen - (10000 * i + 5000 * j)) % 1000 == 0
						&& (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j ) {
					fukuzawa = i;
					higuchi = j;
					noguchi = n-i-j;
					break;
				}
			}
		}
		System.out.println(fukuzawa + " "+ higuchi +" " + noguchi);
	}
} Main public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int yen = sc.nextInt();
		int fukuzawa = -1;
		int higuchi = -1;
		int noguchi = -1;

		for(int i = 0;i <= n;i++) {
			if(i * 10000 > yen) {
				break;
			}
			for(int j = 0;j <= n-i;j++) {
				if(10000 * i + 5000 * j > yen) {
					break;
				}
				if((yen - (10000 * i + 5000 * j)) % 1000 == 0
						&& (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j ) {
					fukuzawa = i;
					higuchi = j;
					noguchi = n-i-j;
					break;
				}
			}
		}
		System.out.println(fukuzawa + " "+ higuchi +" " + noguchi);
	} main {


		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int yen = sc.nextInt();
		int fukuzawa = -1;
		int higuchi = -1;
		int noguchi = -1;

		for(int i = 0;i <= n;i++) {
			if(i * 10000 > yen) {
				break;
			}
			for(int j = 0;j <= n-i;j++) {
				if(10000 * i + 5000 * j > yen) {
					break;
				}
				if((yen - (10000 * i + 5000 * j)) % 1000 == 0
						&& (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j ) {
					fukuzawa = i;
					higuchi = j;
					noguchi = n-i-j;
					break;
				}
			}
		}
		System.out.println(fukuzawa + " "+ higuchi +" " + noguchi);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int yen = sc.nextInt(); yen sc.nextInt() sc.nextInt sc int fukuzawa = -1; fukuzawa -1 1 int higuchi = -1; higuchi -1 1 int noguchi = -1; noguchi -1 1 for(int i = 0;i <= n;i++) {
			if(i * 10000 > yen) {
				break;
			}
			for(int j = 0;j <= n-i;j++) {
				if(10000 * i + 5000 * j > yen) {
					break;
				}
				if((yen - (10000 * i + 5000 * j)) % 1000 == 0
						&& (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j ) {
					fukuzawa = i;
					higuchi = j;
					noguchi = n-i-j;
					break;
				}
			}
		} int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
			if(i * 10000 > yen) {
				break;
			}
			for(int j = 0;j <= n-i;j++) {
				if(10000 * i + 5000 * j > yen) {
					break;
				}
				if((yen - (10000 * i + 5000 * j)) % 1000 == 0
						&& (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j ) {
					fukuzawa = i;
					higuchi = j;
					noguchi = n-i-j;
					break;
				}
			}
		} {
			if(i * 10000 > yen) {
				break;
			}
			for(int j = 0;j <= n-i;j++) {
				if(10000 * i + 5000 * j > yen) {
					break;
				}
				if((yen - (10000 * i + 5000 * j)) % 1000 == 0
						&& (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j ) {
					fukuzawa = i;
					higuchi = j;
					noguchi = n-i-j;
					break;
				}
			}
		} if(i * 10000 > yen) {
				break;
			} i * 10000 > yen i * 10000 i 10000 yen {
				break;
			} break; for(int j = 0;j <= n-i;j++) {
				if(10000 * i + 5000 * j > yen) {
					break;
				}
				if((yen - (10000 * i + 5000 * j)) % 1000 == 0
						&& (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j ) {
					fukuzawa = i;
					higuchi = j;
					noguchi = n-i-j;
					break;
				}
			} int j = 0; int j = 0; j 0 j <= n-i j n-i n i j++ j++ j {
				if(10000 * i + 5000 * j > yen) {
					break;
				}
				if((yen - (10000 * i + 5000 * j)) % 1000 == 0
						&& (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j ) {
					fukuzawa = i;
					higuchi = j;
					noguchi = n-i-j;
					break;
				}
			} {
				if(10000 * i + 5000 * j > yen) {
					break;
				}
				if((yen - (10000 * i + 5000 * j)) % 1000 == 0
						&& (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j ) {
					fukuzawa = i;
					higuchi = j;
					noguchi = n-i-j;
					break;
				}
			} if(10000 * i + 5000 * j > yen) {
					break;
				} 10000 * i + 5000 * j > yen 10000 * i + 5000 * j 10000 * i 10000 i 5000 * j 5000 j yen {
					break;
				} break; if((yen - (10000 * i + 5000 * j)) % 1000 == 0
						&& (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j ) {
					fukuzawa = i;
					higuchi = j;
					noguchi = n-i-j;
					break;
				} (yen - (10000 * i + 5000 * j)) % 1000 == 0
						&& (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j (yen - (10000 * i + 5000 * j)) % 1000 == 0 (yen - (10000 * i + 5000 * j)) % 1000 (yen - (10000 * i + 5000 * j)) yen (10000 * i + 5000 * j) 10000 * i 10000 i 5000 * j 5000 j 1000 0 (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j (yen - (10000 * i + 5000 * j)) / 1000 (yen - (10000 * i + 5000 * j)) yen (10000 * i + 5000 * j) 10000 * i 10000 i 5000 * j 5000 j 1000 n-i-j n-i-j n i j {
					fukuzawa = i;
					higuchi = j;
					noguchi = n-i-j;
					break;
				} fukuzawa = i fukuzawa i higuchi = j higuchi j noguchi = n-i-j noguchi n-i-j n-i-j n i j break; System.out.println(fukuzawa + " "+ higuchi +" " + noguchi) System.out.println System.out System System.out fukuzawa + " "+ higuchi +" " + noguchi " " higuchi fukuzawa + " "+ higuchi +" " + noguchi fukuzawa " " higuchi " " noguchi String[] args args public class Main {

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int yen = sc.nextInt();
		int fukuzawa = -1;
		int higuchi = -1;
		int noguchi = -1;

		for(int i = 0;i <= n;i++) {
			if(i * 10000 > yen) {
				break;
			}
			for(int j = 0;j <= n-i;j++) {
				if(10000 * i + 5000 * j > yen) {
					break;
				}
				if((yen - (10000 * i + 5000 * j)) % 1000 == 0
						&& (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j ) {
					fukuzawa = i;
					higuchi = j;
					noguchi = n-i-j;
					break;
				}
			}
		}
		System.out.println(fukuzawa + " "+ higuchi +" " + noguchi);
	}
} public class Main {

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int yen = sc.nextInt();
		int fukuzawa = -1;
		int higuchi = -1;
		int noguchi = -1;

		for(int i = 0;i <= n;i++) {
			if(i * 10000 > yen) {
				break;
			}
			for(int j = 0;j <= n-i;j++) {
				if(10000 * i + 5000 * j > yen) {
					break;
				}
				if((yen - (10000 * i + 5000 * j)) % 1000 == 0
						&& (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j ) {
					fukuzawa = i;
					higuchi = j;
					noguchi = n-i-j;
					break;
				}
			}
		}
		System.out.println(fukuzawa + " "+ higuchi +" " + noguchi);
	}
} 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 yen = sc.nextInt();
		int fukuzawa = -1;
		int higuchi = -1;
		int noguchi = -1;

		for(int i = 0;i <= n;i++) {
			if(i * 10000 > yen) {
				break;
			}
			for(int j = 0;j <= n-i;j++) {
				if(10000 * i + 5000 * j > yen) {
					break;
				}
				if((yen - (10000 * i + 5000 * j)) % 1000 == 0
						&& (yen - (10000 * i + 5000 * j)) / 1000 == n-i-j ) {
					fukuzawa = i;
					higuchi = j;
					noguchi = n-i-j;
					break;
				}
			}
		}
		System.out.println(fukuzawa + " "+ higuchi +" " + noguchi);
	}
}