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();
    
    for(int i=0; i <= N; i++) {
      for(int j = 0; j <= N - i; j++) {
        int l = N - i - j;
        int y = i*10000 + j*5000 + l*1000;
        
        if(y==Y){
          System.out.println(i + " " + j + " " + l );
          return;
        }
      }
    }
    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();
    
    for(int i=0; i <= N; i++) {
      for(int j = 0; j <= N - i; j++) {
        int l = N - i - j;
        int y = i*10000 + j*5000 + l*1000;
        
        if(y==Y){
          System.out.println(i + " " + j + " " + l );
          return;
        }
      }
    }
    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();
    
    for(int i=0; i <= N; i++) {
      for(int j = 0; j <= N - i; j++) {
        int l = N - i - j;
        int y = i*10000 + j*5000 + l*1000;
        
        if(y==Y){
          System.out.println(i + " " + j + " " + l );
          return;
        }
      }
    }
    System.out.println("-1 -1 -1");
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long Y = sc.nextLong();
    
    for(int i=0; i <= N; i++) {
      for(int j = 0; j <= N - i; j++) {
        int l = N - i - j;
        int y = i*10000 + j*5000 + l*1000;
        
        if(y==Y){
          System.out.println(i + " " + j + " " + l );
          return;
        }
      }
    }
    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 for(int i=0; i <= N; i++) {
      for(int j = 0; j <= N - i; j++) {
        int l = N - i - j;
        int y = i*10000 + j*5000 + l*1000;
        
        if(y==Y){
          System.out.println(i + " " + j + " " + l );
          return;
        }
      }
    } int i=0; int i=0; i 0 i <= N i N i++ i++ i {
      for(int j = 0; j <= N - i; j++) {
        int l = N - i - j;
        int y = i*10000 + j*5000 + l*1000;
        
        if(y==Y){
          System.out.println(i + " " + j + " " + l );
          return;
        }
      }
    } {
      for(int j = 0; j <= N - i; j++) {
        int l = N - i - j;
        int y = i*10000 + j*5000 + l*1000;
        
        if(y==Y){
          System.out.println(i + " " + j + " " + l );
          return;
        }
      }
    } for(int j = 0; j <= N - i; j++) {
        int l = N - i - j;
        int y = i*10000 + j*5000 + l*1000;
        
        if(y==Y){
          System.out.println(i + " " + j + " " + l );
          return;
        }
      } int j = 0; int j = 0; j 0 j <= N - i j N - i N i j++ j++ j {
        int l = N - i - j;
        int y = i*10000 + j*5000 + l*1000;
        
        if(y==Y){
          System.out.println(i + " " + j + " " + l );
          return;
        }
      } {
        int l = N - i - j;
        int y = i*10000 + j*5000 + l*1000;
        
        if(y==Y){
          System.out.println(i + " " + j + " " + l );
          return;
        }
      } int l = N - i - j; l N - i - j N - i - j N i j int y = i*10000 + j*5000 + l*1000; y i*10000 + j*5000 + l*1000 i*10000 + j*5000 + l*1000 i*10000 i 10000 j*5000 j 5000 l*1000 l 1000 if(y==Y){
          System.out.println(i + " " + j + " " + l );
          return;
        } y==Y y Y {
          System.out.println(i + " " + j + " " + l );
          return;
        } System.out.println(i + " " + j + " " + l ) System.out.println System.out System System.out i + " " + j + " " + l " " j i + " " + j + " " + l i " " j " " l return; 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();
    
    for(int i=0; i <= N; i++) {
      for(int j = 0; j <= N - i; j++) {
        int l = N - i - j;
        int y = i*10000 + j*5000 + l*1000;
        
        if(y==Y){
          System.out.println(i + " " + j + " " + l );
          return;
        }
      }
    }
    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();
    
    for(int i=0; i <= N; i++) {
      for(int j = 0; j <= N - i; j++) {
        int l = N - i - j;
        int y = i*10000 + j*5000 + l*1000;
        
        if(y==Y){
          System.out.println(i + " " + j + " " + l );
          return;
        }
      }
    }
    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();
    
    for(int i=0; i <= N; i++) {
      for(int j = 0; j <= N - i; j++) {
        int l = N - i - j;
        int y = i*10000 + j*5000 + l*1000;
        
        if(y==Y){
          System.out.println(i + " " + j + " " + l );
          return;
        }
      }
    }
    System.out.println("-1 -1 -1");
  }
}
    