import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N,Y;
		N=sc.nextInt();
		Y=sc.nextInt();
		int A=-1,B=-1,C=-1;
		boolean flag=false;
		for(int a=0;a<=N;a++) {
			for(int b=0;b<=N-a;b++) {
				int c=N-a-b;
				int total=a*10000+b*5000+c*1000;
				if(total==Y) {
					A=a;
					B=b;
					C=c;
					flag=true;
				
				}
				
			}
			
			
		}
			
		System.out.println(A+" "+B+" "+C);
		
	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N,Y;
		N=sc.nextInt();
		Y=sc.nextInt();
		int A=-1,B=-1,C=-1;
		boolean flag=false;
		for(int a=0;a<=N;a++) {
			for(int b=0;b<=N-a;b++) {
				int c=N-a-b;
				int total=a*10000+b*5000+c*1000;
				if(total==Y) {
					A=a;
					B=b;
					C=c;
					flag=true;
				
				}
				
			}
			
			
		}
			
		System.out.println(A+" "+B+" "+C);
		
	}

} Main public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N,Y;
		N=sc.nextInt();
		Y=sc.nextInt();
		int A=-1,B=-1,C=-1;
		boolean flag=false;
		for(int a=0;a<=N;a++) {
			for(int b=0;b<=N-a;b++) {
				int c=N-a-b;
				int total=a*10000+b*5000+c*1000;
				if(total==Y) {
					A=a;
					B=b;
					C=c;
					flag=true;
				
				}
				
			}
			
			
		}
			
		System.out.println(A+" "+B+" "+C);
		
	} main {
		Scanner sc=new Scanner(System.in);
		int N,Y;
		N=sc.nextInt();
		Y=sc.nextInt();
		int A=-1,B=-1,C=-1;
		boolean flag=false;
		for(int a=0;a<=N;a++) {
			for(int b=0;b<=N-a;b++) {
				int c=N-a-b;
				int total=a*10000+b*5000+c*1000;
				if(total==Y) {
					A=a;
					B=b;
					C=c;
					flag=true;
				
				}
				
			}
			
			
		}
			
		System.out.println(A+" "+B+" "+C);
		
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int N N Y; Y N=sc.nextInt() N sc.nextInt() sc.nextInt sc Y=sc.nextInt() Y sc.nextInt() sc.nextInt sc int A=-1 A -1 1 B=-1 B -1 1 C=-1; C -1 1 boolean flag=false; flag false for(int a=0;a<=N;a++) {
			for(int b=0;b<=N-a;b++) {
				int c=N-a-b;
				int total=a*10000+b*5000+c*1000;
				if(total==Y) {
					A=a;
					B=b;
					C=c;
					flag=true;
				
				}
				
			}
			
			
		} int a=0; int a=0; a 0 a<=N a N a++ a++ a {
			for(int b=0;b<=N-a;b++) {
				int c=N-a-b;
				int total=a*10000+b*5000+c*1000;
				if(total==Y) {
					A=a;
					B=b;
					C=c;
					flag=true;
				
				}
				
			}
			
			
		} {
			for(int b=0;b<=N-a;b++) {
				int c=N-a-b;
				int total=a*10000+b*5000+c*1000;
				if(total==Y) {
					A=a;
					B=b;
					C=c;
					flag=true;
				
				}
				
			}
			
			
		} for(int b=0;b<=N-a;b++) {
				int c=N-a-b;
				int total=a*10000+b*5000+c*1000;
				if(total==Y) {
					A=a;
					B=b;
					C=c;
					flag=true;
				
				}
				
			} int b=0; int b=0; b 0 b<=N-a b N-a N a b++ b++ b {
				int c=N-a-b;
				int total=a*10000+b*5000+c*1000;
				if(total==Y) {
					A=a;
					B=b;
					C=c;
					flag=true;
				
				}
				
			} {
				int c=N-a-b;
				int total=a*10000+b*5000+c*1000;
				if(total==Y) {
					A=a;
					B=b;
					C=c;
					flag=true;
				
				}
				
			} int c=N-a-b; c N-a-b N-a-b N a b int total=a*10000+b*5000+c*1000; total a*10000+b*5000+c*1000 a*10000+b*5000+c*1000 a*10000 a 10000 b*5000 b 5000 c*1000 c 1000 if(total==Y) {
					A=a;
					B=b;
					C=c;
					flag=true;
				
				} total==Y total Y {
					A=a;
					B=b;
					C=c;
					flag=true;
				
				} A=a A a B=b B b C=c C c flag=true flag true System.out.println(A+" "+B+" "+C) System.out.println System.out System System.out A+" "+B+" "+C " " B A+" "+B+" "+C A " " B " " C String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N,Y;
		N=sc.nextInt();
		Y=sc.nextInt();
		int A=-1,B=-1,C=-1;
		boolean flag=false;
		for(int a=0;a<=N;a++) {
			for(int b=0;b<=N-a;b++) {
				int c=N-a-b;
				int total=a*10000+b*5000+c*1000;
				if(total==Y) {
					A=a;
					B=b;
					C=c;
					flag=true;
				
				}
				
			}
			
			
		}
			
		System.out.println(A+" "+B+" "+C);
		
	}

} public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N,Y;
		N=sc.nextInt();
		Y=sc.nextInt();
		int A=-1,B=-1,C=-1;
		boolean flag=false;
		for(int a=0;a<=N;a++) {
			for(int b=0;b<=N-a;b++) {
				int c=N-a-b;
				int total=a*10000+b*5000+c*1000;
				if(total==Y) {
					A=a;
					B=b;
					C=c;
					flag=true;
				
				}
				
			}
			
			
		}
			
		System.out.println(A+" "+B+" "+C);
		
	}

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N,Y;
		N=sc.nextInt();
		Y=sc.nextInt();
		int A=-1,B=-1,C=-1;
		boolean flag=false;
		for(int a=0;a<=N;a++) {
			for(int b=0;b<=N-a;b++) {
				int c=N-a-b;
				int total=a*10000+b*5000+c*1000;
				if(total==Y) {
					A=a;
					B=b;
					C=c;
					flag=true;
				
				}
				
			}
			
			
		}
			
		System.out.println(A+" "+B+" "+C);
		
	}

}
