import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      	int y = sc.nextInt();
      	int k = -1;
      	int k5 = -1;
      	int k10 = -1;
      	int num = 0;
      	for(int i=0; i<=n; i++){
          for(int j=0; j<=n-i; j++){
            num = 1000*i + 5000*j + 10000*(n-j-i);
            if(num==y){
              k=i;
              k5=j;
              k10=n-j-i;
            }
          }
        }
      	System.out.println(k10 + " " + k5 + " " + k);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      	int y = sc.nextInt();
      	int k = -1;
      	int k5 = -1;
      	int k10 = -1;
      	int num = 0;
      	for(int i=0; i<=n; i++){
          for(int j=0; j<=n-i; j++){
            num = 1000*i + 5000*j + 10000*(n-j-i);
            if(num==y){
              k=i;
              k5=j;
              k10=n-j-i;
            }
          }
        }
      	System.out.println(k10 + " " + k5 + " " + k);
	}
} Main public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      	int y = sc.nextInt();
      	int k = -1;
      	int k5 = -1;
      	int k10 = -1;
      	int num = 0;
      	for(int i=0; i<=n; i++){
          for(int j=0; j<=n-i; j++){
            num = 1000*i + 5000*j + 10000*(n-j-i);
            if(num==y){
              k=i;
              k5=j;
              k10=n-j-i;
            }
          }
        }
      	System.out.println(k10 + " " + k5 + " " + k);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      	int y = sc.nextInt();
      	int k = -1;
      	int k5 = -1;
      	int k10 = -1;
      	int num = 0;
      	for(int i=0; i<=n; i++){
          for(int j=0; j<=n-i; j++){
            num = 1000*i + 5000*j + 10000*(n-j-i);
            if(num==y){
              k=i;
              k5=j;
              k10=n-j-i;
            }
          }
        }
      	System.out.println(k10 + " " + k5 + " " + k);
	} 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 int k = -1; k -1 1 int k5 = -1; k5 -1 1 int k10 = -1; k10 -1 1 int num = 0; num 0 for(int i=0; i<=n; i++){
          for(int j=0; j<=n-i; j++){
            num = 1000*i + 5000*j + 10000*(n-j-i);
            if(num==y){
              k=i;
              k5=j;
              k10=n-j-i;
            }
          }
        } int i=0; int i=0; i 0 i<=n i n i++ i++ i {
          for(int j=0; j<=n-i; j++){
            num = 1000*i + 5000*j + 10000*(n-j-i);
            if(num==y){
              k=i;
              k5=j;
              k10=n-j-i;
            }
          }
        } {
          for(int j=0; j<=n-i; j++){
            num = 1000*i + 5000*j + 10000*(n-j-i);
            if(num==y){
              k=i;
              k5=j;
              k10=n-j-i;
            }
          }
        } for(int j=0; j<=n-i; j++){
            num = 1000*i + 5000*j + 10000*(n-j-i);
            if(num==y){
              k=i;
              k5=j;
              k10=n-j-i;
            }
          } int j=0; int j=0; j 0 j<=n-i j n-i n i j++ j++ j {
            num = 1000*i + 5000*j + 10000*(n-j-i);
            if(num==y){
              k=i;
              k5=j;
              k10=n-j-i;
            }
          } {
            num = 1000*i + 5000*j + 10000*(n-j-i);
            if(num==y){
              k=i;
              k5=j;
              k10=n-j-i;
            }
          } num = 1000*i + 5000*j + 10000*(n-j-i) num 1000*i + 5000*j + 10000*(n-j-i) 1000*i + 5000*j + 10000*(n-j-i) 1000*i 1000 i 5000*j 5000 j 10000*(n-j-i) 10000 (n-j-i) n-j-i n j i if(num==y){
              k=i;
              k5=j;
              k10=n-j-i;
            } num==y num y {
              k=i;
              k5=j;
              k10=n-j-i;
            } k=i k i k5=j k5 j k10=n-j-i k10 n-j-i n-j-i n j i System.out.println(k10 + " " + k5 + " " + k) System.out.println System.out System System.out k10 + " " + k5 + " " + k " " k5 k10 + " " + k5 + " " + k k10 " " k5 " " k String[] args args public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      	int y = sc.nextInt();
      	int k = -1;
      	int k5 = -1;
      	int k10 = -1;
      	int num = 0;
      	for(int i=0; i<=n; i++){
          for(int j=0; j<=n-i; j++){
            num = 1000*i + 5000*j + 10000*(n-j-i);
            if(num==y){
              k=i;
              k5=j;
              k10=n-j-i;
            }
          }
        }
      	System.out.println(k10 + " " + k5 + " " + k);
	}
} public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      	int y = sc.nextInt();
      	int k = -1;
      	int k5 = -1;
      	int k10 = -1;
      	int num = 0;
      	for(int i=0; i<=n; i++){
          for(int j=0; j<=n-i; j++){
            num = 1000*i + 5000*j + 10000*(n-j-i);
            if(num==y){
              k=i;
              k5=j;
              k10=n-j-i;
            }
          }
        }
      	System.out.println(k10 + " " + k5 + " " + k);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      	int y = sc.nextInt();
      	int k = -1;
      	int k5 = -1;
      	int k10 = -1;
      	int num = 0;
      	for(int i=0; i<=n; i++){
          for(int j=0; j<=n-i; j++){
            num = 1000*i + 5000*j + 10000*(n-j-i);
            if(num==y){
              k=i;
              k5=j;
              k10=n-j-i;
            }
          }
        }
      	System.out.println(k10 + " " + k5 + " " + k);
	}
}
