import java.util.*;
 
class Main {
  
    public static void main(String[] args) {
      
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
      	int mo = sc.nextInt();
      
      for(int i = 0;i <= N;i++){
      	for(int j = 0;j+i<= N;j++){
              if(i*10000+j*5000+(N-i-j)*1000==mo){
                	System.out.print(i+" "+j+" "+(N-i-j));
                          	return;
                          }
          }
        }
      System.out.print(-1+" "+-1+" "+-1);
    }
} import java.util.*; util.* java class Main {
  
    public static void main(String[] args) {
      
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
      	int mo = sc.nextInt();
      
      for(int i = 0;i <= N;i++){
      	for(int j = 0;j+i<= N;j++){
              if(i*10000+j*5000+(N-i-j)*1000==mo){
                	System.out.print(i+" "+j+" "+(N-i-j));
                          	return;
                          }
          }
        }
      System.out.print(-1+" "+-1+" "+-1);
    }
} Main public static void main(String[] args) {
      
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
      	int mo = sc.nextInt();
      
      for(int i = 0;i <= N;i++){
      	for(int j = 0;j+i<= N;j++){
              if(i*10000+j*5000+(N-i-j)*1000==mo){
                	System.out.print(i+" "+j+" "+(N-i-j));
                          	return;
                          }
          }
        }
      System.out.print(-1+" "+-1+" "+-1);
    } main {
      
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
      	int mo = sc.nextInt();
      
      for(int i = 0;i <= N;i++){
      	for(int j = 0;j+i<= N;j++){
              if(i*10000+j*5000+(N-i-j)*1000==mo){
                	System.out.print(i+" "+j+" "+(N-i-j));
                          	return;
                          }
          }
        }
      System.out.print(-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 mo = sc.nextInt(); mo sc.nextInt() sc.nextInt sc for(int i = 0;i <= N;i++){
      	for(int j = 0;j+i<= N;j++){
              if(i*10000+j*5000+(N-i-j)*1000==mo){
                	System.out.print(i+" "+j+" "+(N-i-j));
                          	return;
                          }
          }
        } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
      	for(int j = 0;j+i<= N;j++){
              if(i*10000+j*5000+(N-i-j)*1000==mo){
                	System.out.print(i+" "+j+" "+(N-i-j));
                          	return;
                          }
          }
        } {
      	for(int j = 0;j+i<= N;j++){
              if(i*10000+j*5000+(N-i-j)*1000==mo){
                	System.out.print(i+" "+j+" "+(N-i-j));
                          	return;
                          }
          }
        } for(int j = 0;j+i<= N;j++){
              if(i*10000+j*5000+(N-i-j)*1000==mo){
                	System.out.print(i+" "+j+" "+(N-i-j));
                          	return;
                          }
          } int j = 0; int j = 0; j 0 j+i<= N j+i j i N j++ j++ j {
              if(i*10000+j*5000+(N-i-j)*1000==mo){
                	System.out.print(i+" "+j+" "+(N-i-j));
                          	return;
                          }
          } {
              if(i*10000+j*5000+(N-i-j)*1000==mo){
                	System.out.print(i+" "+j+" "+(N-i-j));
                          	return;
                          }
          } if(i*10000+j*5000+(N-i-j)*1000==mo){
                	System.out.print(i+" "+j+" "+(N-i-j));
                          	return;
                          } i*10000+j*5000+(N-i-j)*1000==mo i*10000+j*5000+(N-i-j)*1000 i*10000+j*5000+(N-i-j)*1000 i*10000 i 10000 j*5000 j 5000 (N-i-j)*1000 (N-i-j) N-i-j N i j 1000 mo {
                	System.out.print(i+" "+j+" "+(N-i-j));
                          	return;
                          } System.out.print(i+" "+j+" "+(N-i-j)) System.out.print System.out System System.out i+" "+j+" "+(N-i-j) " " j i+" "+j+" "+(N-i-j) i " " j " " (N-i-j) N-i-j N i j return; System.out.print(-1+" "+-1+" "+-1) System.out.print System.out System System.out -1+" "+-1+" "+-1 " " -1 -1+" "+-1+" "+-1 -1 1 " " -1 1 " " -1 1 String[] args args
import java.util.*;
 
class Main {
  
    public static void main(String[] args) {
      
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
      	int mo = sc.nextInt();
      
      for(int i = 0;i <= N;i++){
      	for(int j = 0;j+i<= N;j++){
              if(i*10000+j*5000+(N-i-j)*1000==mo){
                	System.out.print(i+" "+j+" "+(N-i-j));
                          	return;
                          }
          }
        }
      System.out.print(-1+" "+-1+" "+-1);
    }
}