import java.util.*;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int sum = sc.nextInt();
		if(sum%1000!=0){
			System.out.println("-1 -1 -1");
			return;
		}
		//五千円
		for (int i=0; i<=num; i++) {
			//一万円	
			for (int j=0; j<=num; j++) {
				if(i+j>num) continue;
				int tmp = i*5000 + j*10000;
				if(tmp>sum) continue;
				if(sum==tmp && i+j==num){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" 0");
					return;					
				}
				if((sum-tmp) % 1000 == 0 && (num-i-j)*1000+tmp==sum){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j));
					return;
				}
			}			
		}
		System.out.println("-1 -1 -1");

	}

} import java.util.*; util.* java class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int sum = sc.nextInt();
		if(sum%1000!=0){
			System.out.println("-1 -1 -1");
			return;
		}
		//五千円
		for (int i=0; i<=num; i++) {
			//一万円	
			for (int j=0; j<=num; j++) {
				if(i+j>num) continue;
				int tmp = i*5000 + j*10000;
				if(tmp>sum) continue;
				if(sum==tmp && i+j==num){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" 0");
					return;					
				}
				if((sum-tmp) % 1000 == 0 && (num-i-j)*1000+tmp==sum){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j));
					return;
				}
			}			
		}
		System.out.println("-1 -1 -1");

	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int sum = sc.nextInt();
		if(sum%1000!=0){
			System.out.println("-1 -1 -1");
			return;
		}
		//五千円
		for (int i=0; i<=num; i++) {
			//一万円	
			for (int j=0; j<=num; j++) {
				if(i+j>num) continue;
				int tmp = i*5000 + j*10000;
				if(tmp>sum) continue;
				if(sum==tmp && i+j==num){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" 0");
					return;					
				}
				if((sum-tmp) % 1000 == 0 && (num-i-j)*1000+tmp==sum){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j));
					return;
				}
			}			
		}
		System.out.println("-1 -1 -1");

	} main {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int sum = sc.nextInt();
		if(sum%1000!=0){
			System.out.println("-1 -1 -1");
			return;
		}
		//五千円
		for (int i=0; i<=num; i++) {
			//一万円	
			for (int j=0; j<=num; j++) {
				if(i+j>num) continue;
				int tmp = i*5000 + j*10000;
				if(tmp>sum) continue;
				if(sum==tmp && i+j==num){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" 0");
					return;					
				}
				if((sum-tmp) % 1000 == 0 && (num-i-j)*1000+tmp==sum){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j));
					return;
				}
			}			
		}
		System.out.println("-1 -1 -1");

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc int sum = sc.nextInt(); sum sc.nextInt() sc.nextInt sc if(sum%1000!=0){
			System.out.println("-1 -1 -1");
			return;
		} sum%1000!=0 sum%1000 sum 1000 0 {
			System.out.println("-1 -1 -1");
			return;
		} System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" return; for (int i=0; i<=num; i++) {
			//一万円	
			for (int j=0; j<=num; j++) {
				if(i+j>num) continue;
				int tmp = i*5000 + j*10000;
				if(tmp>sum) continue;
				if(sum==tmp && i+j==num){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" 0");
					return;					
				}
				if((sum-tmp) % 1000 == 0 && (num-i-j)*1000+tmp==sum){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j));
					return;
				}
			}			
		} int i=0; int i=0; i 0 i<=num i num i++ i++ i {
			//一万円	
			for (int j=0; j<=num; j++) {
				if(i+j>num) continue;
				int tmp = i*5000 + j*10000;
				if(tmp>sum) continue;
				if(sum==tmp && i+j==num){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" 0");
					return;					
				}
				if((sum-tmp) % 1000 == 0 && (num-i-j)*1000+tmp==sum){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j));
					return;
				}
			}			
		} {
			//一万円	
			for (int j=0; j<=num; j++) {
				if(i+j>num) continue;
				int tmp = i*5000 + j*10000;
				if(tmp>sum) continue;
				if(sum==tmp && i+j==num){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" 0");
					return;					
				}
				if((sum-tmp) % 1000 == 0 && (num-i-j)*1000+tmp==sum){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j));
					return;
				}
			}			
		} for (int j=0; j<=num; j++) {
				if(i+j>num) continue;
				int tmp = i*5000 + j*10000;
				if(tmp>sum) continue;
				if(sum==tmp && i+j==num){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" 0");
					return;					
				}
				if((sum-tmp) % 1000 == 0 && (num-i-j)*1000+tmp==sum){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j));
					return;
				}
			} int j=0; int j=0; j 0 j<=num j num j++ j++ j {
				if(i+j>num) continue;
				int tmp = i*5000 + j*10000;
				if(tmp>sum) continue;
				if(sum==tmp && i+j==num){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" 0");
					return;					
				}
				if((sum-tmp) % 1000 == 0 && (num-i-j)*1000+tmp==sum){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j));
					return;
				}
			} {
				if(i+j>num) continue;
				int tmp = i*5000 + j*10000;
				if(tmp>sum) continue;
				if(sum==tmp && i+j==num){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" 0");
					return;					
				}
				if((sum-tmp) % 1000 == 0 && (num-i-j)*1000+tmp==sum){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j));
					return;
				}
			} if(i+j>num) continue; i+j>num i+j i j num continue; int tmp = i*5000 + j*10000; tmp i*5000 + j*10000 i*5000 i 5000 j*10000 j 10000 if(tmp>sum) continue; tmp>sum tmp sum continue; if(sum==tmp && i+j==num){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" 0");
					return;					
				} sum==tmp && i+j==num sum==tmp sum tmp i+j==num i+j i j num {
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" 0");
					return;					
				} System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" 0") System.out.println System.out System System.out Integer.toString(j)+" "+Integer.toString(i)+" 0" Integer.toString(i) Integer.toString(j)+" "+Integer.toString(i)+" 0" Integer.toString(j) Integer.toString Integer j " " Integer.toString(i) Integer.toString Integer i " 0" return; if((sum-tmp) % 1000 == 0 && (num-i-j)*1000+tmp==sum){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j));
					return;
				} (sum-tmp) % 1000 == 0 && (num-i-j)*1000+tmp==sum (sum-tmp) % 1000 == 0 (sum-tmp) % 1000 (sum-tmp) sum tmp 1000 0 (num-i-j)*1000+tmp==sum (num-i-j)*1000+tmp (num-i-j)*1000 (num-i-j) num-i-j num i j 1000 tmp sum {
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j));
					return;
				} System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j)) System.out.println System.out System System.out Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j) " " Integer.toString(i) Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j) Integer.toString(j) Integer.toString Integer j " " Integer.toString(i) Integer.toString Integer i " " Integer.toString(num-i-j) Integer.toString Integer num-i-j num-i-j num i j return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[] args args
import java.util.*;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int sum = sc.nextInt();
		if(sum%1000!=0){
			System.out.println("-1 -1 -1");
			return;
		}
		//五千円
		for (int i=0; i<=num; i++) {
			//一万円	
			for (int j=0; j<=num; j++) {
				if(i+j>num) continue;
				int tmp = i*5000 + j*10000;
				if(tmp>sum) continue;
				if(sum==tmp && i+j==num){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" 0");
					return;					
				}
				if((sum-tmp) % 1000 == 0 && (num-i-j)*1000+tmp==sum){
					System.out.println(Integer.toString(j)+" "+Integer.toString(i)+" "+Integer.toString(num-i-j));
					return;
				}
			}			
		}
		System.out.println("-1 -1 -1");

	}

}