import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
        int n = sc.nextInt();
      	long y = sc.nextLong();
      	long lstack,lstack2,lstack3;
      	int ilimit = (int)(y/10000);
      	int jlimit;
      	int num;
      	boolean con = true;
      
      	for(int i = 0;i <= ilimit && con; i++){
       	  lstack = y;	
          lstack -= 10000*i;
          jlimit = (int)lstack/5000;
          for(int j = 0;j <= jlimit && con;j++){
       	    num = j + (int)((lstack-5000*j)/1000);
            if((i+num) == n) {
              System.out.println(i + " " + j + " " + (num-j));
              con = false;
            }                         
          }
        }
	  	if(con) System.out.println("-1 -1 -1");
      
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
        int n = sc.nextInt();
      	long y = sc.nextLong();
      	long lstack,lstack2,lstack3;
      	int ilimit = (int)(y/10000);
      	int jlimit;
      	int num;
      	boolean con = true;
      
      	for(int i = 0;i <= ilimit && con; i++){
       	  lstack = y;	
          lstack -= 10000*i;
          jlimit = (int)lstack/5000;
          for(int j = 0;j <= jlimit && con;j++){
       	    num = j + (int)((lstack-5000*j)/1000);
            if((i+num) == n) {
              System.out.println(i + " " + j + " " + (num-j));
              con = false;
            }                         
          }
        }
	  	if(con) System.out.println("-1 -1 -1");
      
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
        int n = sc.nextInt();
      	long y = sc.nextLong();
      	long lstack,lstack2,lstack3;
      	int ilimit = (int)(y/10000);
      	int jlimit;
      	int num;
      	boolean con = true;
      
      	for(int i = 0;i <= ilimit && con; i++){
       	  lstack = y;	
          lstack -= 10000*i;
          jlimit = (int)lstack/5000;
          for(int j = 0;j <= jlimit && con;j++){
       	    num = j + (int)((lstack-5000*j)/1000);
            if((i+num) == n) {
              System.out.println(i + " " + j + " " + (num-j));
              con = false;
            }                         
          }
        }
	  	if(con) System.out.println("-1 -1 -1");
      
	} main {
		Scanner sc = new Scanner(System.in);
		
        int n = sc.nextInt();
      	long y = sc.nextLong();
      	long lstack,lstack2,lstack3;
      	int ilimit = (int)(y/10000);
      	int jlimit;
      	int num;
      	boolean con = true;
      
      	for(int i = 0;i <= ilimit && con; i++){
       	  lstack = y;	
          lstack -= 10000*i;
          jlimit = (int)lstack/5000;
          for(int j = 0;j <= jlimit && con;j++){
       	    num = j + (int)((lstack-5000*j)/1000);
            if((i+num) == n) {
              System.out.println(i + " " + j + " " + (num-j));
              con = false;
            }                         
          }
        }
	  	if(con) 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 long y = sc.nextLong(); y sc.nextLong() sc.nextLong sc long lstack lstack lstack2 lstack2 lstack3; lstack3 int ilimit = (int)(y/10000); ilimit (int)(y/10000) y 10000 int jlimit; jlimit int num; num boolean con = true; con true for(int i = 0;i <= ilimit && con; i++){
       	  lstack = y;	
          lstack -= 10000*i;
          jlimit = (int)lstack/5000;
          for(int j = 0;j <= jlimit && con;j++){
       	    num = j + (int)((lstack-5000*j)/1000);
            if((i+num) == n) {
              System.out.println(i + " " + j + " " + (num-j));
              con = false;
            }                         
          }
        } int i = 0; int i = 0; i 0 i <= ilimit && con i <= ilimit i ilimit con i++ i++ i {
       	  lstack = y;	
          lstack -= 10000*i;
          jlimit = (int)lstack/5000;
          for(int j = 0;j <= jlimit && con;j++){
       	    num = j + (int)((lstack-5000*j)/1000);
            if((i+num) == n) {
              System.out.println(i + " " + j + " " + (num-j));
              con = false;
            }                         
          }
        } {
       	  lstack = y;	
          lstack -= 10000*i;
          jlimit = (int)lstack/5000;
          for(int j = 0;j <= jlimit && con;j++){
       	    num = j + (int)((lstack-5000*j)/1000);
            if((i+num) == n) {
              System.out.println(i + " " + j + " " + (num-j));
              con = false;
            }                         
          }
        } lstack = y lstack y lstack -= 10000*i lstack 10000*i 10000 i jlimit = (int)lstack/5000 jlimit (int)lstack/5000 (int)lstack 5000 for(int j = 0;j <= jlimit && con;j++){
       	    num = j + (int)((lstack-5000*j)/1000);
            if((i+num) == n) {
              System.out.println(i + " " + j + " " + (num-j));
              con = false;
            }                         
          } int j = 0; int j = 0; j 0 j <= jlimit && con j <= jlimit j jlimit con j++ j++ j {
       	    num = j + (int)((lstack-5000*j)/1000);
            if((i+num) == n) {
              System.out.println(i + " " + j + " " + (num-j));
              con = false;
            }                         
          } {
       	    num = j + (int)((lstack-5000*j)/1000);
            if((i+num) == n) {
              System.out.println(i + " " + j + " " + (num-j));
              con = false;
            }                         
          } num = j + (int)((lstack-5000*j)/1000) num j + (int)((lstack-5000*j)/1000) j (int)((lstack-5000*j)/1000) (lstack-5000*j) lstack 5000*j 5000 j 1000 if((i+num) == n) {
              System.out.println(i + " " + j + " " + (num-j));
              con = false;
            } (i+num) == n (i+num) i num n {
              System.out.println(i + " " + j + " " + (num-j));
              con = false;
            } System.out.println(i + " " + j + " " + (num-j)) System.out.println System.out System System.out i + " " + j + " " + (num-j) " " j i + " " + j + " " + (num-j) i " " j " " (num-j) num j con = false con false if(con) System.out.println("-1 -1 -1"); con System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
        int n = sc.nextInt();
      	long y = sc.nextLong();
      	long lstack,lstack2,lstack3;
      	int ilimit = (int)(y/10000);
      	int jlimit;
      	int num;
      	boolean con = true;
      
      	for(int i = 0;i <= ilimit && con; i++){
       	  lstack = y;	
          lstack -= 10000*i;
          jlimit = (int)lstack/5000;
          for(int j = 0;j <= jlimit && con;j++){
       	    num = j + (int)((lstack-5000*j)/1000);
            if((i+num) == n) {
              System.out.println(i + " " + j + " " + (num-j));
              con = false;
            }                         
          }
        }
	  	if(con) 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();
      	long y = sc.nextLong();
      	long lstack,lstack2,lstack3;
      	int ilimit = (int)(y/10000);
      	int jlimit;
      	int num;
      	boolean con = true;
      
      	for(int i = 0;i <= ilimit && con; i++){
       	  lstack = y;	
          lstack -= 10000*i;
          jlimit = (int)lstack/5000;
          for(int j = 0;j <= jlimit && con;j++){
       	    num = j + (int)((lstack-5000*j)/1000);
            if((i+num) == n) {
              System.out.println(i + " " + j + " " + (num-j));
              con = false;
            }                         
          }
        }
	  	if(con) System.out.println("-1 -1 -1");
      
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
        int n = sc.nextInt();
      	long y = sc.nextLong();
      	long lstack,lstack2,lstack3;
      	int ilimit = (int)(y/10000);
      	int jlimit;
      	int num;
      	boolean con = true;
      
      	for(int i = 0;i <= ilimit && con; i++){
       	  lstack = y;	
          lstack -= 10000*i;
          jlimit = (int)lstack/5000;
          for(int j = 0;j <= jlimit && con;j++){
       	    num = j + (int)((lstack-5000*j)/1000);
            if((i+num) == n) {
              System.out.println(i + " " + j + " " + (num-j));
              con = false;
            }                         
          }
        }
	  	if(con) System.out.println("-1 -1 -1");
      
	}
}