import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();

    int Yukichi = 0;
    int Higuchi = 0;
    int Noguchi = 0;
    
    boolean flag = false;

    loop: for(Yukichi = 0; Yukichi <= N; Yukichi++){
      for(Higuchi = 0; Yukichi + Higuchi <= N; Higuchi++){
        Noguchi = N - (Yukichi + Higuchi);
        int num = 10000*Yukichi + 5000*Higuchi + 1000*Noguchi;
        if(num == Y){
        	flag = true;
        	System.out.println(Yukichi +" "+ Higuchi +" "+ Noguchi);
        	break loop;
        }
      }
    }
    
    if(!flag)
    	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();
    int Y = sc.nextInt();

    int Yukichi = 0;
    int Higuchi = 0;
    int Noguchi = 0;
    
    boolean flag = false;

    loop: for(Yukichi = 0; Yukichi <= N; Yukichi++){
      for(Higuchi = 0; Yukichi + Higuchi <= N; Higuchi++){
        Noguchi = N - (Yukichi + Higuchi);
        int num = 10000*Yukichi + 5000*Higuchi + 1000*Noguchi;
        if(num == Y){
        	flag = true;
        	System.out.println(Yukichi +" "+ Higuchi +" "+ Noguchi);
        	break loop;
        }
      }
    }
    
    if(!flag)
    	System.out.println(-1 +" "+ -1 +" "+ -1);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();

    int Yukichi = 0;
    int Higuchi = 0;
    int Noguchi = 0;
    
    boolean flag = false;

    loop: for(Yukichi = 0; Yukichi <= N; Yukichi++){
      for(Higuchi = 0; Yukichi + Higuchi <= N; Higuchi++){
        Noguchi = N - (Yukichi + Higuchi);
        int num = 10000*Yukichi + 5000*Higuchi + 1000*Noguchi;
        if(num == Y){
        	flag = true;
        	System.out.println(Yukichi +" "+ Higuchi +" "+ Noguchi);
        	break loop;
        }
      }
    }
    
    if(!flag)
    	System.out.println(-1 +" "+ -1 +" "+ -1);
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();

    int Yukichi = 0;
    int Higuchi = 0;
    int Noguchi = 0;
    
    boolean flag = false;

    loop: for(Yukichi = 0; Yukichi <= N; Yukichi++){
      for(Higuchi = 0; Yukichi + Higuchi <= N; Higuchi++){
        Noguchi = N - (Yukichi + Higuchi);
        int num = 10000*Yukichi + 5000*Higuchi + 1000*Noguchi;
        if(num == Y){
        	flag = true;
        	System.out.println(Yukichi +" "+ Higuchi +" "+ Noguchi);
        	break loop;
        }
      }
    }
    
    if(!flag)
    	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 int Y = sc.nextInt(); Y sc.nextInt() sc.nextInt sc int Yukichi = 0; Yukichi 0 int Higuchi = 0; Higuchi 0 int Noguchi = 0; Noguchi 0 boolean flag = false; flag false if(!flag)
    	System.out.println(-1 +" "+ -1 +" "+ -1); !flag flag System.out.println(-1 +" "+ -1 +" "+ -1) System.out.println System.out System System.out -1 +" "+ -1 +" "+ -1 " " -1 -1 +" "+ -1 +" "+ -1 -1 1 " " -1 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();
    int Y = sc.nextInt();

    int Yukichi = 0;
    int Higuchi = 0;
    int Noguchi = 0;
    
    boolean flag = false;

    loop: for(Yukichi = 0; Yukichi <= N; Yukichi++){
      for(Higuchi = 0; Yukichi + Higuchi <= N; Higuchi++){
        Noguchi = N - (Yukichi + Higuchi);
        int num = 10000*Yukichi + 5000*Higuchi + 1000*Noguchi;
        if(num == Y){
        	flag = true;
        	System.out.println(Yukichi +" "+ Higuchi +" "+ Noguchi);
        	break loop;
        }
      }
    }
    
    if(!flag)
    	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();
    int Y = sc.nextInt();

    int Yukichi = 0;
    int Higuchi = 0;
    int Noguchi = 0;
    
    boolean flag = false;

    loop: for(Yukichi = 0; Yukichi <= N; Yukichi++){
      for(Higuchi = 0; Yukichi + Higuchi <= N; Higuchi++){
        Noguchi = N - (Yukichi + Higuchi);
        int num = 10000*Yukichi + 5000*Higuchi + 1000*Noguchi;
        if(num == Y){
        	flag = true;
        	System.out.println(Yukichi +" "+ Higuchi +" "+ Noguchi);
        	break loop;
        }
      }
    }
    
    if(!flag)
    	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();
    int Y = sc.nextInt();

    int Yukichi = 0;
    int Higuchi = 0;
    int Noguchi = 0;
    
    boolean flag = false;

    loop: for(Yukichi = 0; Yukichi <= N; Yukichi++){
      for(Higuchi = 0; Yukichi + Higuchi <= N; Higuchi++){
        Noguchi = N - (Yukichi + Higuchi);
        int num = 10000*Yukichi + 5000*Higuchi + 1000*Noguchi;
        if(num == Y){
        	flag = true;
        	System.out.println(Yukichi +" "+ Higuchi +" "+ Noguchi);
        	break loop;
        }
      }
    }
    
    if(!flag)
    	System.out.println(-1 +" "+ -1 +" "+ -1);
  }
}