import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int Y = stdIn.nextInt() / 1000;
		
		int ans10 = -1;
		int ans5 = -1;
		int ans1 = -1;
		
		for(int i = 0; i <= N; i ++) {
			for(int j = 0; j <= N - i; j ++) {
				if(10 * i + 5 * j + (N - i - j) == Y) {
					ans10 = i;
					ans5 = j;
					ans1 = N - i - j;
					break;
				}
			}
		}
		
		System.out.println(ans10 + " " + ans5 + " " + ans1);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int Y = stdIn.nextInt() / 1000;
		
		int ans10 = -1;
		int ans5 = -1;
		int ans1 = -1;
		
		for(int i = 0; i <= N; i ++) {
			for(int j = 0; j <= N - i; j ++) {
				if(10 * i + 5 * j + (N - i - j) == Y) {
					ans10 = i;
					ans5 = j;
					ans1 = N - i - j;
					break;
				}
			}
		}
		
		System.out.println(ans10 + " " + ans5 + " " + ans1);
	}
} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int Y = stdIn.nextInt() / 1000;
		
		int ans10 = -1;
		int ans5 = -1;
		int ans1 = -1;
		
		for(int i = 0; i <= N; i ++) {
			for(int j = 0; j <= N - i; j ++) {
				if(10 * i + 5 * j + (N - i - j) == Y) {
					ans10 = i;
					ans5 = j;
					ans1 = N - i - j;
					break;
				}
			}
		}
		
		System.out.println(ans10 + " " + ans5 + " " + ans1);
	} main {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int Y = stdIn.nextInt() / 1000;
		
		int ans10 = -1;
		int ans5 = -1;
		int ans1 = -1;
		
		for(int i = 0; i <= N; i ++) {
			for(int j = 0; j <= N - i; j ++) {
				if(10 * i + 5 * j + (N - i - j) == Y) {
					ans10 = i;
					ans5 = j;
					ans1 = N - i - j;
					break;
				}
			}
		}
		
		System.out.println(ans10 + " " + ans5 + " " + ans1);
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int N = stdIn.nextInt(); N stdIn.nextInt() stdIn.nextInt stdIn int Y = stdIn.nextInt() / 1000; Y stdIn.nextInt() / 1000 stdIn.nextInt() stdIn.nextInt stdIn 1000 int ans10 = -1; ans10 -1 1 int ans5 = -1; ans5 -1 1 int ans1 = -1; ans1 -1 1 for(int i = 0; i <= N; i ++) {
			for(int j = 0; j <= N - i; j ++) {
				if(10 * i + 5 * j + (N - i - j) == Y) {
					ans10 = i;
					ans5 = j;
					ans1 = N - i - j;
					break;
				}
			}
		} int i = 0; int i = 0; i 0 i <= N i N i ++ i ++ i {
			for(int j = 0; j <= N - i; j ++) {
				if(10 * i + 5 * j + (N - i - j) == Y) {
					ans10 = i;
					ans5 = j;
					ans1 = N - i - j;
					break;
				}
			}
		} {
			for(int j = 0; j <= N - i; j ++) {
				if(10 * i + 5 * j + (N - i - j) == Y) {
					ans10 = i;
					ans5 = j;
					ans1 = N - i - j;
					break;
				}
			}
		} for(int j = 0; j <= N - i; j ++) {
				if(10 * i + 5 * j + (N - i - j) == Y) {
					ans10 = i;
					ans5 = j;
					ans1 = N - i - j;
					break;
				}
			} int j = 0; int j = 0; j 0 j <= N - i j N - i N i j ++ j ++ j {
				if(10 * i + 5 * j + (N - i - j) == Y) {
					ans10 = i;
					ans5 = j;
					ans1 = N - i - j;
					break;
				}
			} {
				if(10 * i + 5 * j + (N - i - j) == Y) {
					ans10 = i;
					ans5 = j;
					ans1 = N - i - j;
					break;
				}
			} if(10 * i + 5 * j + (N - i - j) == Y) {
					ans10 = i;
					ans5 = j;
					ans1 = N - i - j;
					break;
				} 10 * i + 5 * j + (N - i - j) == Y 10 * i + 5 * j + (N - i - j) 10 * i + 5 * j + (N - i - j) 10 * i 10 i 5 * j 5 j (N - i - j) N - i - j N i j Y {
					ans10 = i;
					ans5 = j;
					ans1 = N - i - j;
					break;
				} ans10 = i ans10 i ans5 = j ans5 j ans1 = N - i - j ans1 N - i - j N - i - j N i j break; System.out.println(ans10 + " " + ans5 + " " + ans1) System.out.println System.out System System.out ans10 + " " + ans5 + " " + ans1 " " ans5 ans10 + " " + ans5 + " " + ans1 ans10 " " ans5 " " ans1 String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int Y = stdIn.nextInt() / 1000;
		
		int ans10 = -1;
		int ans5 = -1;
		int ans1 = -1;
		
		for(int i = 0; i <= N; i ++) {
			for(int j = 0; j <= N - i; j ++) {
				if(10 * i + 5 * j + (N - i - j) == Y) {
					ans10 = i;
					ans5 = j;
					ans1 = N - i - j;
					break;
				}
			}
		}
		
		System.out.println(ans10 + " " + ans5 + " " + ans1);
	}
} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int Y = stdIn.nextInt() / 1000;
		
		int ans10 = -1;
		int ans5 = -1;
		int ans1 = -1;
		
		for(int i = 0; i <= N; i ++) {
			for(int j = 0; j <= N - i; j ++) {
				if(10 * i + 5 * j + (N - i - j) == Y) {
					ans10 = i;
					ans5 = j;
					ans1 = N - i - j;
					break;
				}
			}
		}
		
		System.out.println(ans10 + " " + ans5 + " " + ans1);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int Y = stdIn.nextInt() / 1000;
		
		int ans10 = -1;
		int ans5 = -1;
		int ans1 = -1;
		
		for(int i = 0; i <= N; i ++) {
			for(int j = 0; j <= N - i; j ++) {
				if(10 * i + 5 * j + (N - i - j) == Y) {
					ans10 = i;
					ans5 = j;
					ans1 = N - i - j;
					break;
				}
			}
		}
		
		System.out.println(ans10 + " " + ans5 + " " + ans1);
	}
}