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