import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int y = sc.nextInt();
		
		// 計算
		String result = "-1 -1 -1";
		int a = y/10000;
		int b = (y%10000)/5000;
		int c = (y%5000)/1000;
		
		for(int i = 0; i <= a; i++){
		    for(int j = 0; j <= b + (a - i)*2; j++){
		        int k = c + (b + (a - i)*2 - j)*5;
		        if(i + j + k == n){
		            System.out.println(i + " " + j + " " + k);
		            return;
		        }
		    }
		}
		
		// 出力
		System.out.println(result);
	}
}
 import java.util.*; util.* java import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; import java.math.BigInteger; BigInteger java.math public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int y = sc.nextInt();
		
		// 計算
		String result = "-1 -1 -1";
		int a = y/10000;
		int b = (y%10000)/5000;
		int c = (y%5000)/1000;
		
		for(int i = 0; i <= a; i++){
		    for(int j = 0; j <= b + (a - i)*2; j++){
		        int k = c + (b + (a - i)*2 - j)*5;
		        if(i + j + k == n){
		            System.out.println(i + " " + j + " " + k);
		            return;
		        }
		    }
		}
		
		// 出力
		System.out.println(result);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int y = sc.nextInt();
		
		// 計算
		String result = "-1 -1 -1";
		int a = y/10000;
		int b = (y%10000)/5000;
		int c = (y%5000)/1000;
		
		for(int i = 0; i <= a; i++){
		    for(int j = 0; j <= b + (a - i)*2; j++){
		        int k = c + (b + (a - i)*2 - j)*5;
		        if(i + j + k == n){
		            System.out.println(i + " " + j + " " + k);
		            return;
		        }
		    }
		}
		
		// 出力
		System.out.println(result);
	} main {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int y = sc.nextInt();
		
		// 計算
		String result = "-1 -1 -1";
		int a = y/10000;
		int b = (y%10000)/5000;
		int c = (y%5000)/1000;
		
		for(int i = 0; i <= a; i++){
		    for(int j = 0; j <= b + (a - i)*2; j++){
		        int k = c + (b + (a - i)*2 - j)*5;
		        if(i + j + k == n){
		            System.out.println(i + " " + j + " " + k);
		            return;
		        }
		    }
		}
		
		// 出力
		System.out.println(result);
	} 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 result = "-1 -1 -1"; result "-1 -1 -1" int a = y/10000; a y/10000 y 10000 int b = (y%10000)/5000; b (y%10000)/5000 (y%10000) y 10000 5000 int c = (y%5000)/1000; c (y%5000)/1000 (y%5000) y 5000 1000 for(int i = 0; i <= a; i++){
		    for(int j = 0; j <= b + (a - i)*2; j++){
		        int k = c + (b + (a - i)*2 - j)*5;
		        if(i + j + k == n){
		            System.out.println(i + " " + j + " " + k);
		            return;
		        }
		    }
		} int i = 0; int i = 0; i 0 i <= a i a i++ i++ i {
		    for(int j = 0; j <= b + (a - i)*2; j++){
		        int k = c + (b + (a - i)*2 - j)*5;
		        if(i + j + k == n){
		            System.out.println(i + " " + j + " " + k);
		            return;
		        }
		    }
		} {
		    for(int j = 0; j <= b + (a - i)*2; j++){
		        int k = c + (b + (a - i)*2 - j)*5;
		        if(i + j + k == n){
		            System.out.println(i + " " + j + " " + k);
		            return;
		        }
		    }
		} for(int j = 0; j <= b + (a - i)*2; j++){
		        int k = c + (b + (a - i)*2 - j)*5;
		        if(i + j + k == n){
		            System.out.println(i + " " + j + " " + k);
		            return;
		        }
		    } int j = 0; int j = 0; j 0 j <= b + (a - i)*2 j b + (a - i)*2 b (a - i)*2 (a - i) a i 2 j++ j++ j {
		        int k = c + (b + (a - i)*2 - j)*5;
		        if(i + j + k == n){
		            System.out.println(i + " " + j + " " + k);
		            return;
		        }
		    } {
		        int k = c + (b + (a - i)*2 - j)*5;
		        if(i + j + k == n){
		            System.out.println(i + " " + j + " " + k);
		            return;
		        }
		    } int k = c + (b + (a - i)*2 - j)*5; k c + (b + (a - i)*2 - j)*5 c (b + (a - i)*2 - j)*5 (b + (a - i)*2 - j) b + (a - i)*2 b (a - i)*2 (a - i) a i 2 j 5 if(i + j + k == n){
		            System.out.println(i + " " + j + " " + k);
		            return;
		        } i + j + k == n i + j + k i + j + k i j k n {
		            System.out.println(i + " " + j + " " + k);
		            return;
		        } System.out.println(i + " " + j + " " + k) System.out.println System.out System System.out i + " " + j + " " + k " " j i + " " + j + " " + k i " " j " " k return; System.out.println(result) System.out.println System.out System System.out result 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();
		
		// 計算
		String result = "-1 -1 -1";
		int a = y/10000;
		int b = (y%10000)/5000;
		int c = (y%5000)/1000;
		
		for(int i = 0; i <= a; i++){
		    for(int j = 0; j <= b + (a - i)*2; j++){
		        int k = c + (b + (a - i)*2 - j)*5;
		        if(i + j + k == n){
		            System.out.println(i + " " + j + " " + k);
		            return;
		        }
		    }
		}
		
		// 出力
		System.out.println(result);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int y = sc.nextInt();
		
		// 計算
		String result = "-1 -1 -1";
		int a = y/10000;
		int b = (y%10000)/5000;
		int c = (y%5000)/1000;
		
		for(int i = 0; i <= a; i++){
		    for(int j = 0; j <= b + (a - i)*2; j++){
		        int k = c + (b + (a - i)*2 - j)*5;
		        if(i + j + k == n){
		            System.out.println(i + " " + j + " " + k);
		            return;
		        }
		    }
		}
		
		// 出力
		System.out.println(result);
	}
} Main
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int y = sc.nextInt();
		
		// 計算
		String result = "-1 -1 -1";
		int a = y/10000;
		int b = (y%10000)/5000;
		int c = (y%5000)/1000;
		
		for(int i = 0; i <= a; i++){
		    for(int j = 0; j <= b + (a - i)*2; j++){
		        int k = c + (b + (a - i)*2 - j)*5;
		        if(i + j + k == n){
		            System.out.println(i + " " + j + " " + k);
		            return;
		        }
		    }
		}
		
		// 出力
		System.out.println(result);
	}
}

