import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int Y = sc.nextInt();
		loop:for( int i=0; i<=N; i++ ){
			for( int j=0; j<=N; j++ ){
				if( i+j<=N ){
					if( i*10000 + j*5000 + (N-i-j)*1000 == Y ){
						System.out.println(i+" "+j+" "+(N-i-j));
						break loop;
					}
				}
			}
			if( i==N ){
				System.out.println(-1+" "+(-1)+" "+(-1));
			}
		}
	}
} import java.util.*; util.* java import java.lang.*; lang.* java public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int Y = sc.nextInt();
		loop:for( int i=0; i<=N; i++ ){
			for( int j=0; j<=N; j++ ){
				if( i+j<=N ){
					if( i*10000 + j*5000 + (N-i-j)*1000 == Y ){
						System.out.println(i+" "+j+" "+(N-i-j));
						break loop;
					}
				}
			}
			if( i==N ){
				System.out.println(-1+" "+(-1)+" "+(-1));
			}
		}
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int Y = sc.nextInt();
		loop:for( int i=0; i<=N; i++ ){
			for( int j=0; j<=N; j++ ){
				if( i+j<=N ){
					if( i*10000 + j*5000 + (N-i-j)*1000 == Y ){
						System.out.println(i+" "+j+" "+(N-i-j));
						break loop;
					}
				}
			}
			if( i==N ){
				System.out.println(-1+" "+(-1)+" "+(-1));
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int Y = sc.nextInt();
		loop:for( int i=0; i<=N; i++ ){
			for( int j=0; j<=N; j++ ){
				if( i+j<=N ){
					if( i*10000 + j*5000 + (N-i-j)*1000 == Y ){
						System.out.println(i+" "+j+" "+(N-i-j));
						break loop;
					}
				}
			}
			if( i==N ){
				System.out.println(-1+" "+(-1)+" "+(-1));
			}
		}
	} 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 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();
		loop:for( int i=0; i<=N; i++ ){
			for( int j=0; j<=N; j++ ){
				if( i+j<=N ){
					if( i*10000 + j*5000 + (N-i-j)*1000 == Y ){
						System.out.println(i+" "+j+" "+(N-i-j));
						break loop;
					}
				}
			}
			if( i==N ){
				System.out.println(-1+" "+(-1)+" "+(-1));
			}
		}
	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int Y = sc.nextInt();
		loop:for( int i=0; i<=N; i++ ){
			for( int j=0; j<=N; j++ ){
				if( i+j<=N ){
					if( i*10000 + j*5000 + (N-i-j)*1000 == Y ){
						System.out.println(i+" "+j+" "+(N-i-j));
						break loop;
					}
				}
			}
			if( i==N ){
				System.out.println(-1+" "+(-1)+" "+(-1));
			}
		}
	}
} Main
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int Y = sc.nextInt();
		loop:for( int i=0; i<=N; i++ ){
			for( int j=0; j<=N; j++ ){
				if( i+j<=N ){
					if( i*10000 + j*5000 + (N-i-j)*1000 == Y ){
						System.out.println(i+" "+j+" "+(N-i-j));
						break loop;
					}
				}
			}
			if( i==N ){
				System.out.println(-1+" "+(-1)+" "+(-1));
			}
		}
	}
}
