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[] count = {-1, -1, -1};
		int[] amount = {10000, 5000, 1000};
		boolean isExist = false;
		
		for(int i = 0;(i <= n) && (amount[0] * i <= y);i++) {
			for(int j = 0;(amount[1] * j <= y) && (j <= n - i);j++) {
				int k = n - j - i;
				if(amount[0] * i + amount[1] * j + amount[2] * k == y) {
					count[0] = i;
					count[1] = j;
					count[2] = k;
					isExist = true;
					break;
				}
			}
			
			if(isExist) {
				break;
			}
		}
		
		System.out.println(count[0] + " " + count[1] + " " + count[2]);
    }
} 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[] count = {-1, -1, -1};
		int[] amount = {10000, 5000, 1000};
		boolean isExist = false;
		
		for(int i = 0;(i <= n) && (amount[0] * i <= y);i++) {
			for(int j = 0;(amount[1] * j <= y) && (j <= n - i);j++) {
				int k = n - j - i;
				if(amount[0] * i + amount[1] * j + amount[2] * k == y) {
					count[0] = i;
					count[1] = j;
					count[2] = k;
					isExist = true;
					break;
				}
			}
			
			if(isExist) {
				break;
			}
		}
		
		System.out.println(count[0] + " " + count[1] + " " + count[2]);
    }
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int y = sc.nextInt();
		int[] count = {-1, -1, -1};
		int[] amount = {10000, 5000, 1000};
		boolean isExist = false;
		
		for(int i = 0;(i <= n) && (amount[0] * i <= y);i++) {
			for(int j = 0;(amount[1] * j <= y) && (j <= n - i);j++) {
				int k = n - j - i;
				if(amount[0] * i + amount[1] * j + amount[2] * k == y) {
					count[0] = i;
					count[1] = j;
					count[2] = k;
					isExist = true;
					break;
				}
			}
			
			if(isExist) {
				break;
			}
		}
		
		System.out.println(count[0] + " " + count[1] + " " + count[2]);
    } main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int y = sc.nextInt();
		int[] count = {-1, -1, -1};
		int[] amount = {10000, 5000, 1000};
		boolean isExist = false;
		
		for(int i = 0;(i <= n) && (amount[0] * i <= y);i++) {
			for(int j = 0;(amount[1] * j <= y) && (j <= n - i);j++) {
				int k = n - j - i;
				if(amount[0] * i + amount[1] * j + amount[2] * k == y) {
					count[0] = i;
					count[1] = j;
					count[2] = k;
					isExist = true;
					break;
				}
			}
			
			if(isExist) {
				break;
			}
		}
		
		System.out.println(count[0] + " " + count[1] + " " + count[2]);
    } 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[] count = {-1, -1, -1}; count {-1, -1, -1} -1 1 -1 1 -1 1 int[] amount = {10000, 5000, 1000}; amount {10000, 5000, 1000} 10000 5000 1000 boolean isExist = false; isExist false for(int i = 0;(i <= n) && (amount[0] * i <= y);i++) {
			for(int j = 0;(amount[1] * j <= y) && (j <= n - i);j++) {
				int k = n - j - i;
				if(amount[0] * i + amount[1] * j + amount[2] * k == y) {
					count[0] = i;
					count[1] = j;
					count[2] = k;
					isExist = true;
					break;
				}
			}
			
			if(isExist) {
				break;
			}
		} int i = 0; int i = 0; i 0 (i <= n) && (amount[0] * i <= y) (i <= n) i n (amount[0] * i <= y) amount[0] * i amount[0] amount 0 i y i++ i++ i {
			for(int j = 0;(amount[1] * j <= y) && (j <= n - i);j++) {
				int k = n - j - i;
				if(amount[0] * i + amount[1] * j + amount[2] * k == y) {
					count[0] = i;
					count[1] = j;
					count[2] = k;
					isExist = true;
					break;
				}
			}
			
			if(isExist) {
				break;
			}
		} {
			for(int j = 0;(amount[1] * j <= y) && (j <= n - i);j++) {
				int k = n - j - i;
				if(amount[0] * i + amount[1] * j + amount[2] * k == y) {
					count[0] = i;
					count[1] = j;
					count[2] = k;
					isExist = true;
					break;
				}
			}
			
			if(isExist) {
				break;
			}
		} for(int j = 0;(amount[1] * j <= y) && (j <= n - i);j++) {
				int k = n - j - i;
				if(amount[0] * i + amount[1] * j + amount[2] * k == y) {
					count[0] = i;
					count[1] = j;
					count[2] = k;
					isExist = true;
					break;
				}
			} int j = 0; int j = 0; j 0 (amount[1] * j <= y) && (j <= n - i) (amount[1] * j <= y) amount[1] * j amount[1] amount 1 j y (j <= n - i) j n - i n i j++ j++ j {
				int k = n - j - i;
				if(amount[0] * i + amount[1] * j + amount[2] * k == y) {
					count[0] = i;
					count[1] = j;
					count[2] = k;
					isExist = true;
					break;
				}
			} {
				int k = n - j - i;
				if(amount[0] * i + amount[1] * j + amount[2] * k == y) {
					count[0] = i;
					count[1] = j;
					count[2] = k;
					isExist = true;
					break;
				}
			} int k = n - j - i; k n - j - i n - j - i n j i if(amount[0] * i + amount[1] * j + amount[2] * k == y) {
					count[0] = i;
					count[1] = j;
					count[2] = k;
					isExist = true;
					break;
				} amount[0] * i + amount[1] * j + amount[2] * k == y amount[0] * i + amount[1] * j + amount[2] * k amount[0] * i + amount[1] * j + amount[2] * k amount[0] * i amount[0] amount 0 i amount[1] * j amount[1] amount 1 j amount[2] * k amount[2] amount 2 k y {
					count[0] = i;
					count[1] = j;
					count[2] = k;
					isExist = true;
					break;
				} count[0] = i count[0] count 0 i count[1] = j count[1] count 1 j count[2] = k count[2] count 2 k isExist = true isExist true break; if(isExist) {
				break;
			} isExist {
				break;
			} break; System.out.println(count[0] + " " + count[1] + " " + count[2]) System.out.println System.out System System.out count[0] + " " + count[1] + " " + count[2] " " count[1] count[0] + " " + count[1] + " " + count[2] count[0] count 0 " " count[1] count 1 " " count[2] count 2 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[] count = {-1, -1, -1};
		int[] amount = {10000, 5000, 1000};
		boolean isExist = false;
		
		for(int i = 0;(i <= n) && (amount[0] * i <= y);i++) {
			for(int j = 0;(amount[1] * j <= y) && (j <= n - i);j++) {
				int k = n - j - i;
				if(amount[0] * i + amount[1] * j + amount[2] * k == y) {
					count[0] = i;
					count[1] = j;
					count[2] = k;
					isExist = true;
					break;
				}
			}
			
			if(isExist) {
				break;
			}
		}
		
		System.out.println(count[0] + " " + count[1] + " " + count[2]);
    }
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int y = sc.nextInt();
		int[] count = {-1, -1, -1};
		int[] amount = {10000, 5000, 1000};
		boolean isExist = false;
		
		for(int i = 0;(i <= n) && (amount[0] * i <= y);i++) {
			for(int j = 0;(amount[1] * j <= y) && (j <= n - i);j++) {
				int k = n - j - i;
				if(amount[0] * i + amount[1] * j + amount[2] * k == y) {
					count[0] = i;
					count[1] = j;
					count[2] = k;
					isExist = true;
					break;
				}
			}
			
			if(isExist) {
				break;
			}
		}
		
		System.out.println(count[0] + " " + count[1] + " " + count[2]);
    }
} 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[] count = {-1, -1, -1};
		int[] amount = {10000, 5000, 1000};
		boolean isExist = false;
		
		for(int i = 0;(i <= n) && (amount[0] * i <= y);i++) {
			for(int j = 0;(amount[1] * j <= y) && (j <= n - i);j++) {
				int k = n - j - i;
				if(amount[0] * i + amount[1] * j + amount[2] * k == y) {
					count[0] = i;
					count[1] = j;
					count[2] = k;
					isExist = true;
					break;
				}
			}
			
			if(isExist) {
				break;
			}
		}
		
		System.out.println(count[0] + " " + count[1] + " " + count[2]);
    }
}