import java.util.*;
public class Main {
//for全探索
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner (System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		int ans1 = -1;
		int ans2 = -1;
		int ans3 = -1;
		for(int i = 0; i <=N;i++) {
			for(int j = 0; j <= N;j++) {
				 if((i*10000 + j*5000 + (N-i-j)*1000) == Y) {
					  if(N-i-j < 0)continue;
						ans1 = i;
						ans2 = j;
						ans3 = N-i-j;
						break;
					
				}
			}
			
		}
		System.out.println(ans1+" "+ans2+" "+ans3);
		
	}

} import java.util.*; util.* java public class Main {
//for全探索
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner (System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		int ans1 = -1;
		int ans2 = -1;
		int ans3 = -1;
		for(int i = 0; i <=N;i++) {
			for(int j = 0; j <= N;j++) {
				 if((i*10000 + j*5000 + (N-i-j)*1000) == Y) {
					  if(N-i-j < 0)continue;
						ans1 = i;
						ans2 = j;
						ans3 = N-i-j;
						break;
					
				}
			}
			
		}
		System.out.println(ans1+" "+ans2+" "+ans3);
		
	}

} Main //for全探索
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner (System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		int ans1 = -1;
		int ans2 = -1;
		int ans3 = -1;
		for(int i = 0; i <=N;i++) {
			for(int j = 0; j <= N;j++) {
				 if((i*10000 + j*5000 + (N-i-j)*1000) == Y) {
					  if(N-i-j < 0)continue;
						ans1 = i;
						ans2 = j;
						ans3 = N-i-j;
						break;
					
				}
			}
			
		}
		System.out.println(ans1+" "+ans2+" "+ans3);
		
	} main {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner (System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		int ans1 = -1;
		int ans2 = -1;
		int ans3 = -1;
		for(int i = 0; i <=N;i++) {
			for(int j = 0; j <= N;j++) {
				 if((i*10000 + j*5000 + (N-i-j)*1000) == Y) {
					  if(N-i-j < 0)continue;
						ans1 = i;
						ans2 = j;
						ans3 = N-i-j;
						break;
					
				}
			}
			
		}
		System.out.println(ans1+" "+ans2+" "+ans3);
		
	} 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 ans1 = -1; ans1 -1 1 int ans2 = -1; ans2 -1 1 int ans3 = -1; ans3 -1 1 for(int i = 0; i <=N;i++) {
			for(int j = 0; j <= N;j++) {
				 if((i*10000 + j*5000 + (N-i-j)*1000) == Y) {
					  if(N-i-j < 0)continue;
						ans1 = i;
						ans2 = j;
						ans3 = 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;j++) {
				 if((i*10000 + j*5000 + (N-i-j)*1000) == Y) {
					  if(N-i-j < 0)continue;
						ans1 = i;
						ans2 = j;
						ans3 = N-i-j;
						break;
					
				}
			}
			
		} {
			for(int j = 0; j <= N;j++) {
				 if((i*10000 + j*5000 + (N-i-j)*1000) == Y) {
					  if(N-i-j < 0)continue;
						ans1 = i;
						ans2 = j;
						ans3 = N-i-j;
						break;
					
				}
			}
			
		} for(int j = 0; j <= N;j++) {
				 if((i*10000 + j*5000 + (N-i-j)*1000) == Y) {
					  if(N-i-j < 0)continue;
						ans1 = i;
						ans2 = j;
						ans3 = N-i-j;
						break;
					
				}
			} int j = 0; int j = 0; j 0 j <= N j N j++ j++ j {
				 if((i*10000 + j*5000 + (N-i-j)*1000) == Y) {
					  if(N-i-j < 0)continue;
						ans1 = i;
						ans2 = j;
						ans3 = N-i-j;
						break;
					
				}
			} {
				 if((i*10000 + j*5000 + (N-i-j)*1000) == Y) {
					  if(N-i-j < 0)continue;
						ans1 = i;
						ans2 = j;
						ans3 = N-i-j;
						break;
					
				}
			} if((i*10000 + j*5000 + (N-i-j)*1000) == Y) {
					  if(N-i-j < 0)continue;
						ans1 = i;
						ans2 = j;
						ans3 = N-i-j;
						break;
					
				} (i*10000 + j*5000 + (N-i-j)*1000) == Y (i*10000 + j*5000 + (N-i-j)*1000) i*10000 + j*5000 + (N-i-j)*1000 i*10000 i 10000 j*5000 j 5000 (N-i-j)*1000 (N-i-j) N-i-j N i j 1000 Y {
					  if(N-i-j < 0)continue;
						ans1 = i;
						ans2 = j;
						ans3 = N-i-j;
						break;
					
				} if(N-i-j < 0)continue; N-i-j < 0 N-i-j N-i-j N i j 0 continue; ans1 = i ans1 i ans2 = j ans2 j ans3 = N-i-j ans3 N-i-j N-i-j N i j break; System.out.println(ans1+" "+ans2+" "+ans3) System.out.println System.out System System.out ans1+" "+ans2+" "+ans3 " " ans2 ans1+" "+ans2+" "+ans3 ans1 " " ans2 " " ans3 String[] args args public class Main {
//for全探索
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner (System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		int ans1 = -1;
		int ans2 = -1;
		int ans3 = -1;
		for(int i = 0; i <=N;i++) {
			for(int j = 0; j <= N;j++) {
				 if((i*10000 + j*5000 + (N-i-j)*1000) == Y) {
					  if(N-i-j < 0)continue;
						ans1 = i;
						ans2 = j;
						ans3 = N-i-j;
						break;
					
				}
			}
			
		}
		System.out.println(ans1+" "+ans2+" "+ans3);
		
	}

} public class Main {
//for全探索
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner (System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		int ans1 = -1;
		int ans2 = -1;
		int ans3 = -1;
		for(int i = 0; i <=N;i++) {
			for(int j = 0; j <= N;j++) {
				 if((i*10000 + j*5000 + (N-i-j)*1000) == Y) {
					  if(N-i-j < 0)continue;
						ans1 = i;
						ans2 = j;
						ans3 = N-i-j;
						break;
					
				}
			}
			
		}
		System.out.println(ans1+" "+ans2+" "+ans3);
		
	}

} Main
import java.util.*;
public class Main {
//for全探索
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner (System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		int ans1 = -1;
		int ans2 = -1;
		int ans3 = -1;
		for(int i = 0; i <=N;i++) {
			for(int j = 0; j <= N;j++) {
				 if((i*10000 + j*5000 + (N-i-j)*1000) == Y) {
					  if(N-i-j < 0)continue;
						ans1 = i;
						ans2 = j;
						ans3 = N-i-j;
						break;
					
				}
			}
			
		}
		System.out.println(ans1+" "+ans2+" "+ans3);
		
	}

}