import java.util.*;
public class Main {
	public static void main(String[] args)  {
		Scanner scan =new Scanner(System.in);
		int n=Integer.parseInt(scan.next());
		int y=Integer.parseInt(scan.next());

		int j;
		for(int i=0;i <= n;++i){//　千円札
			for(int k = 0;k <= n-i;++k){//　五千円札
				j=n-k-i;

				if((1000*i+5000*k+10000*j)==y){
					System.out.print(j+" "+k+" "+i);
					System.exit(0);
				}
			}
		}
		System.out.print("-1 -1 -1");

	}
}
//end import java.util.*; util.* java public class Main {
	public static void main(String[] args)  {
		Scanner scan =new Scanner(System.in);
		int n=Integer.parseInt(scan.next());
		int y=Integer.parseInt(scan.next());

		int j;
		for(int i=0;i <= n;++i){//　千円札
			for(int k = 0;k <= n-i;++k){//　五千円札
				j=n-k-i;

				if((1000*i+5000*k+10000*j)==y){
					System.out.print(j+" "+k+" "+i);
					System.exit(0);
				}
			}
		}
		System.out.print("-1 -1 -1");

	}
} Main public static void main(String[] args)  {
		Scanner scan =new Scanner(System.in);
		int n=Integer.parseInt(scan.next());
		int y=Integer.parseInt(scan.next());

		int j;
		for(int i=0;i <= n;++i){//　千円札
			for(int k = 0;k <= n-i;++k){//　五千円札
				j=n-k-i;

				if((1000*i+5000*k+10000*j)==y){
					System.out.print(j+" "+k+" "+i);
					System.exit(0);
				}
			}
		}
		System.out.print("-1 -1 -1");

	} main {
		Scanner scan =new Scanner(System.in);
		int n=Integer.parseInt(scan.next());
		int y=Integer.parseInt(scan.next());

		int j;
		for(int i=0;i <= n;++i){//　千円札
			for(int k = 0;k <= n-i;++k){//　五千円札
				j=n-k-i;

				if((1000*i+5000*k+10000*j)==y){
					System.out.print(j+" "+k+" "+i);
					System.exit(0);
				}
			}
		}
		System.out.print("-1 -1 -1");

	} Scanner scan =new Scanner(System.in); scan new Scanner(System.in) int n=Integer.parseInt(scan.next()); n Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan int y=Integer.parseInt(scan.next()); y Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan int j; j for(int i=0;i <= n;++i){//　千円札
			for(int k = 0;k <= n-i;++k){//　五千円札
				j=n-k-i;

				if((1000*i+5000*k+10000*j)==y){
					System.out.print(j+" "+k+" "+i);
					System.exit(0);
				}
			}
		} int i=0; int i=0; i 0 i <= n i n ++i ++i i {//　千円札
			for(int k = 0;k <= n-i;++k){//　五千円札
				j=n-k-i;

				if((1000*i+5000*k+10000*j)==y){
					System.out.print(j+" "+k+" "+i);
					System.exit(0);
				}
			}
		} {//　千円札
			for(int k = 0;k <= n-i;++k){//　五千円札
				j=n-k-i;

				if((1000*i+5000*k+10000*j)==y){
					System.out.print(j+" "+k+" "+i);
					System.exit(0);
				}
			}
		} for(int k = 0;k <= n-i;++k){//　五千円札
				j=n-k-i;

				if((1000*i+5000*k+10000*j)==y){
					System.out.print(j+" "+k+" "+i);
					System.exit(0);
				}
			} int k = 0; int k = 0; k 0 k <= n-i k n-i n i ++k ++k k {//　五千円札
				j=n-k-i;

				if((1000*i+5000*k+10000*j)==y){
					System.out.print(j+" "+k+" "+i);
					System.exit(0);
				}
			} {//　五千円札
				j=n-k-i;

				if((1000*i+5000*k+10000*j)==y){
					System.out.print(j+" "+k+" "+i);
					System.exit(0);
				}
			} j=n-k-i j n-k-i n-k-i n k i if((1000*i+5000*k+10000*j)==y){
					System.out.print(j+" "+k+" "+i);
					System.exit(0);
				} (1000*i+5000*k+10000*j)==y (1000*i+5000*k+10000*j) 1000*i+5000*k+10000*j 1000*i 1000 i 5000*k 5000 k 10000*j 10000 j y {
					System.out.print(j+" "+k+" "+i);
					System.exit(0);
				} System.out.print(j+" "+k+" "+i) System.out.print System.out System System.out j+" "+k+" "+i " " k j+" "+k+" "+i j " " k " " i System.exit(0) System.exit System 0 System.out.print("-1 -1 -1") System.out.print System.out System System.out "-1 -1 -1" String[] args args public class Main {
	public static void main(String[] args)  {
		Scanner scan =new Scanner(System.in);
		int n=Integer.parseInt(scan.next());
		int y=Integer.parseInt(scan.next());

		int j;
		for(int i=0;i <= n;++i){//　千円札
			for(int k = 0;k <= n-i;++k){//　五千円札
				j=n-k-i;

				if((1000*i+5000*k+10000*j)==y){
					System.out.print(j+" "+k+" "+i);
					System.exit(0);
				}
			}
		}
		System.out.print("-1 -1 -1");

	}
} public class Main {
	public static void main(String[] args)  {
		Scanner scan =new Scanner(System.in);
		int n=Integer.parseInt(scan.next());
		int y=Integer.parseInt(scan.next());

		int j;
		for(int i=0;i <= n;++i){//　千円札
			for(int k = 0;k <= n-i;++k){//　五千円札
				j=n-k-i;

				if((1000*i+5000*k+10000*j)==y){
					System.out.print(j+" "+k+" "+i);
					System.exit(0);
				}
			}
		}
		System.out.print("-1 -1 -1");

	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args)  {
		Scanner scan =new Scanner(System.in);
		int n=Integer.parseInt(scan.next());
		int y=Integer.parseInt(scan.next());

		int j;
		for(int i=0;i <= n;++i){//　千円札
			for(int k = 0;k <= n-i;++k){//　五千円札
				j=n-k-i;

				if((1000*i+5000*k+10000*j)==y){
					System.out.print(j+" "+k+" "+i);
					System.exit(0);
				}
			}
		}
		System.out.print("-1 -1 -1");

	}
}
//end
