import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner sc = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
      	int N = Integer.parseInt(sc.next());
      	int Y = Integer.parseInt(sc.next());
      	
      	int x = 0;
      	int y = 0;
      	int z = 0;
      	boolean judge = false;
      	outside:for(int i = 0; i <= N; i++){
        	for(int j = 0; j <= N - i; j++){
            	z = N - i - j;
              	if(10000 * i + 5000 * j + 1000 * z == Y){
                	x = i;
                  	y = j;
                  	judge = true;
                  	break outside;
                }
            }
        }
      	if(judge){
          	out.println(x + " " + y + " " + z);
        }else {
        	out.println("-1 -1 -1");
        }
        out.close();
    }
} import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner sc = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
      	int N = Integer.parseInt(sc.next());
      	int Y = Integer.parseInt(sc.next());
      	
      	int x = 0;
      	int y = 0;
      	int z = 0;
      	boolean judge = false;
      	outside:for(int i = 0; i <= N; i++){
        	for(int j = 0; j <= N - i; j++){
            	z = N - i - j;
              	if(10000 * i + 5000 * j + 1000 * z == Y){
                	x = i;
                  	y = j;
                  	judge = true;
                  	break outside;
                }
            }
        }
      	if(judge){
          	out.println(x + " " + y + " " + z);
        }else {
        	out.println("-1 -1 -1");
        }
        out.close();
    }
} Main public static void main(String[] args){
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner sc = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
      	int N = Integer.parseInt(sc.next());
      	int Y = Integer.parseInt(sc.next());
      	
      	int x = 0;
      	int y = 0;
      	int z = 0;
      	boolean judge = false;
      	outside:for(int i = 0; i <= N; i++){
        	for(int j = 0; j <= N - i; j++){
            	z = N - i - j;
              	if(10000 * i + 5000 * j + 1000 * z == Y){
                	x = i;
                  	y = j;
                  	judge = true;
                  	break outside;
                }
            }
        }
      	if(judge){
          	out.println(x + " " + y + " " + z);
        }else {
        	out.println("-1 -1 -1");
        }
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner sc = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
      	int N = Integer.parseInt(sc.next());
      	int Y = Integer.parseInt(sc.next());
      	
      	int x = 0;
      	int y = 0;
      	int z = 0;
      	boolean judge = false;
      	outside:for(int i = 0; i <= N; i++){
        	for(int j = 0; j <= N - i; j++){
            	z = N - i - j;
              	if(10000 * i + 5000 * j + 1000 * z == Y){
                	x = i;
                  	y = j;
                  	judge = true;
                  	break outside;
                }
            }
        }
      	if(judge){
          	out.println(x + " " + y + " " + z);
        }else {
        	out.println("-1 -1 -1");
        }
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner sc = new Scanner(inputStream); sc new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int Y = Integer.parseInt(sc.next()); Y Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int x = 0; x 0 int y = 0; y 0 int z = 0; z 0 boolean judge = false; judge false if(judge){
          	out.println(x + " " + y + " " + z);
        }else {
        	out.println("-1 -1 -1");
        } judge {
          	out.println(x + " " + y + " " + z);
        } out.println(x + " " + y + " " + z) out.println out x + " " + y + " " + z " " y x + " " + y + " " + z x " " y " " z {
        	out.println("-1 -1 -1");
        } out.println("-1 -1 -1") out.println out "-1 -1 -1" out.close() out.close out String[] args args public class Main{
	public static void main(String[] args){
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner sc = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
      	int N = Integer.parseInt(sc.next());
      	int Y = Integer.parseInt(sc.next());
      	
      	int x = 0;
      	int y = 0;
      	int z = 0;
      	boolean judge = false;
      	outside:for(int i = 0; i <= N; i++){
        	for(int j = 0; j <= N - i; j++){
            	z = N - i - j;
              	if(10000 * i + 5000 * j + 1000 * z == Y){
                	x = i;
                  	y = j;
                  	judge = true;
                  	break outside;
                }
            }
        }
      	if(judge){
          	out.println(x + " " + y + " " + z);
        }else {
        	out.println("-1 -1 -1");
        }
        out.close();
    }
} public class Main{
	public static void main(String[] args){
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner sc = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
      	int N = Integer.parseInt(sc.next());
      	int Y = Integer.parseInt(sc.next());
      	
      	int x = 0;
      	int y = 0;
      	int z = 0;
      	boolean judge = false;
      	outside:for(int i = 0; i <= N; i++){
        	for(int j = 0; j <= N - i; j++){
            	z = N - i - j;
              	if(10000 * i + 5000 * j + 1000 * z == Y){
                	x = i;
                  	y = j;
                  	judge = true;
                  	break outside;
                }
            }
        }
      	if(judge){
          	out.println(x + " " + y + " " + z);
        }else {
        	out.println("-1 -1 -1");
        }
        out.close();
    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner sc = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
      	int N = Integer.parseInt(sc.next());
      	int Y = Integer.parseInt(sc.next());
      	
      	int x = 0;
      	int y = 0;
      	int z = 0;
      	boolean judge = false;
      	outside:for(int i = 0; i <= N; i++){
        	for(int j = 0; j <= N - i; j++){
            	z = N - i - j;
              	if(10000 * i + 5000 * j + 1000 * z == Y){
                	x = i;
                  	y = j;
                  	judge = true;
                  	break outside;
                }
            }
        }
      	if(judge){
          	out.println(x + " " + y + " " + z);
        }else {
        	out.println("-1 -1 -1");
        }
        out.close();
    }
}