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();

		int othousand = -1;
		int fthousand = -1;
		int tthousand = -1;

		for(int i=0; i<n+1; i++) {
			for(int j=0; j<n-i+1; j++) {
				if(10000*i+5000*j+1000*(n-i-j)==y) {
					tthousand=i;
					fthousand=j;
					othousand=(n-i-j);
				}
			}
		}

		System.out.println(tthousand + " " +fthousand + " " + othousand);

	}

} 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();

		int othousand = -1;
		int fthousand = -1;
		int tthousand = -1;

		for(int i=0; i<n+1; i++) {
			for(int j=0; j<n-i+1; j++) {
				if(10000*i+5000*j+1000*(n-i-j)==y) {
					tthousand=i;
					fthousand=j;
					othousand=(n-i-j);
				}
			}
		}

		System.out.println(tthousand + " " +fthousand + " " + othousand);

	}

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

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int y = sc.nextInt();

		int othousand = -1;
		int fthousand = -1;
		int tthousand = -1;

		for(int i=0; i<n+1; i++) {
			for(int j=0; j<n-i+1; j++) {
				if(10000*i+5000*j+1000*(n-i-j)==y) {
					tthousand=i;
					fthousand=j;
					othousand=(n-i-j);
				}
			}
		}

		System.out.println(tthousand + " " +fthousand + " " + othousand);

	} main {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int y = sc.nextInt();

		int othousand = -1;
		int fthousand = -1;
		int tthousand = -1;

		for(int i=0; i<n+1; i++) {
			for(int j=0; j<n-i+1; j++) {
				if(10000*i+5000*j+1000*(n-i-j)==y) {
					tthousand=i;
					fthousand=j;
					othousand=(n-i-j);
				}
			}
		}

		System.out.println(tthousand + " " +fthousand + " " + othousand);

	} 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 int othousand = -1; othousand -1 1 int fthousand = -1; fthousand -1 1 int tthousand = -1; tthousand -1 1 for(int i=0; i<n+1; i++) {
			for(int j=0; j<n-i+1; j++) {
				if(10000*i+5000*j+1000*(n-i-j)==y) {
					tthousand=i;
					fthousand=j;
					othousand=(n-i-j);
				}
			}
		} int i=0; int i=0; i 0 i<n+1 i n+1 n 1 i++ i++ i {
			for(int j=0; j<n-i+1; j++) {
				if(10000*i+5000*j+1000*(n-i-j)==y) {
					tthousand=i;
					fthousand=j;
					othousand=(n-i-j);
				}
			}
		} {
			for(int j=0; j<n-i+1; j++) {
				if(10000*i+5000*j+1000*(n-i-j)==y) {
					tthousand=i;
					fthousand=j;
					othousand=(n-i-j);
				}
			}
		} for(int j=0; j<n-i+1; j++) {
				if(10000*i+5000*j+1000*(n-i-j)==y) {
					tthousand=i;
					fthousand=j;
					othousand=(n-i-j);
				}
			} int j=0; int j=0; j 0 j<n-i+1 j n-i+1 n-i n i 1 j++ j++ j {
				if(10000*i+5000*j+1000*(n-i-j)==y) {
					tthousand=i;
					fthousand=j;
					othousand=(n-i-j);
				}
			} {
				if(10000*i+5000*j+1000*(n-i-j)==y) {
					tthousand=i;
					fthousand=j;
					othousand=(n-i-j);
				}
			} if(10000*i+5000*j+1000*(n-i-j)==y) {
					tthousand=i;
					fthousand=j;
					othousand=(n-i-j);
				} 10000*i+5000*j+1000*(n-i-j)==y 10000*i+5000*j+1000*(n-i-j) 10000*i+5000*j+1000*(n-i-j) 10000*i 10000 i 5000*j 5000 j 1000*(n-i-j) 1000 (n-i-j) n-i-j n i j y {
					tthousand=i;
					fthousand=j;
					othousand=(n-i-j);
				} tthousand=i tthousand i fthousand=j fthousand j othousand=(n-i-j) othousand (n-i-j) n-i-j n i j System.out.println(tthousand + " " +fthousand + " " + othousand) System.out.println System.out System System.out tthousand + " " +fthousand + " " + othousand " " fthousand tthousand + " " +fthousand + " " + othousand tthousand " " fthousand " " othousand 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();

		int othousand = -1;
		int fthousand = -1;
		int tthousand = -1;

		for(int i=0; i<n+1; i++) {
			for(int j=0; j<n-i+1; j++) {
				if(10000*i+5000*j+1000*(n-i-j)==y) {
					tthousand=i;
					fthousand=j;
					othousand=(n-i-j);
				}
			}
		}

		System.out.println(tthousand + " " +fthousand + " " + othousand);

	}

} public class Main {
	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int y = sc.nextInt();

		int othousand = -1;
		int fthousand = -1;
		int tthousand = -1;

		for(int i=0; i<n+1; i++) {
			for(int j=0; j<n-i+1; j++) {
				if(10000*i+5000*j+1000*(n-i-j)==y) {
					tthousand=i;
					fthousand=j;
					othousand=(n-i-j);
				}
			}
		}

		System.out.println(tthousand + " " +fthousand + " " + othousand);

	}

} 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();

		int othousand = -1;
		int fthousand = -1;
		int tthousand = -1;

		for(int i=0; i<n+1; i++) {
			for(int j=0; j<n-i+1; j++) {
				if(10000*i+5000*j+1000*(n-i-j)==y) {
					tthousand=i;
					fthousand=j;
					othousand=(n-i-j);
				}
			}
		}

		System.out.println(tthousand + " " +fthousand + " " + othousand);

	}

}
