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 a = 0, b = 0, c = 0;
    boolean flag = false;
        for(int i=n;i>=0;i--){     
          for(int j=n-i;j>=0;j--){
              int k = n-i-j;
              int number = 10000 * i + 5000 * j + 1000 * k;
              if(number == y && i + j + k == n){
              	 a = i;
                 b = j;
                 c = k;
                 flag = true;
                
              
            }
          }
         }
    if(flag){
      System.out.println(a +" "+ b +" "+ c);
    }else{
      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 a = 0, b = 0, c = 0;
    boolean flag = false;
        for(int i=n;i>=0;i--){     
          for(int j=n-i;j>=0;j--){
              int k = n-i-j;
              int number = 10000 * i + 5000 * j + 1000 * k;
              if(number == y && i + j + k == n){
              	 a = i;
                 b = j;
                 c = k;
                 flag = true;
                
              
            }
          }
         }
    if(flag){
      System.out.println(a +" "+ b +" "+ c);
    }else{
      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 a = 0, b = 0, c = 0;
    boolean flag = false;
        for(int i=n;i>=0;i--){     
          for(int j=n-i;j>=0;j--){
              int k = n-i-j;
              int number = 10000 * i + 5000 * j + 1000 * k;
              if(number == y && i + j + k == n){
              	 a = i;
                 b = j;
                 c = k;
                 flag = true;
                
              
            }
          }
         }
    if(flag){
      System.out.println(a +" "+ b +" "+ c);
    }else{
      System.out.println("-1" + " " + "-1" + " " + "-1");
    }  
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int y = sc.nextInt();
    
    int a = 0, b = 0, c = 0;
    boolean flag = false;
        for(int i=n;i>=0;i--){     
          for(int j=n-i;j>=0;j--){
              int k = n-i-j;
              int number = 10000 * i + 5000 * j + 1000 * k;
              if(number == y && i + j + k == n){
              	 a = i;
                 b = j;
                 c = k;
                 flag = true;
                
              
            }
          }
         }
    if(flag){
      System.out.println(a +" "+ b +" "+ c);
    }else{
      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 a = 0 a 0 b = 0 b 0 c = 0; c 0 boolean flag = false; flag false for(int i=n;i>=0;i--){     
          for(int j=n-i;j>=0;j--){
              int k = n-i-j;
              int number = 10000 * i + 5000 * j + 1000 * k;
              if(number == y && i + j + k == n){
              	 a = i;
                 b = j;
                 c = k;
                 flag = true;
                
              
            }
          }
         } int i=n; int i=n; i n i>=0 i 0 i-- i-- i {     
          for(int j=n-i;j>=0;j--){
              int k = n-i-j;
              int number = 10000 * i + 5000 * j + 1000 * k;
              if(number == y && i + j + k == n){
              	 a = i;
                 b = j;
                 c = k;
                 flag = true;
                
              
            }
          }
         } {     
          for(int j=n-i;j>=0;j--){
              int k = n-i-j;
              int number = 10000 * i + 5000 * j + 1000 * k;
              if(number == y && i + j + k == n){
              	 a = i;
                 b = j;
                 c = k;
                 flag = true;
                
              
            }
          }
         } for(int j=n-i;j>=0;j--){
              int k = n-i-j;
              int number = 10000 * i + 5000 * j + 1000 * k;
              if(number == y && i + j + k == n){
              	 a = i;
                 b = j;
                 c = k;
                 flag = true;
                
              
            }
          } int j=n-i; int j=n-i; j n-i n i j>=0 j 0 j-- j-- j {
              int k = n-i-j;
              int number = 10000 * i + 5000 * j + 1000 * k;
              if(number == y && i + j + k == n){
              	 a = i;
                 b = j;
                 c = k;
                 flag = true;
                
              
            }
          } {
              int k = n-i-j;
              int number = 10000 * i + 5000 * j + 1000 * k;
              if(number == y && i + j + k == n){
              	 a = i;
                 b = j;
                 c = k;
                 flag = true;
                
              
            }
          } int k = n-i-j; k n-i-j n-i-j n i j int number = 10000 * i + 5000 * j + 1000 * k; number 10000 * i + 5000 * j + 1000 * k 10000 * i + 5000 * j + 1000 * k 10000 * i 10000 i 5000 * j 5000 j 1000 * k 1000 k if(number == y && i + j + k == n){
              	 a = i;
                 b = j;
                 c = k;
                 flag = true;
                
              
            } number == y && i + j + k == n number == y number y i + j + k == n i + j + k i + j + k i j k n {
              	 a = i;
                 b = j;
                 c = k;
                 flag = true;
                
              
            } a = i a i b = j b j c = k c k flag = true flag true if(flag){
      System.out.println(a +" "+ b +" "+ c);
    }else{
      System.out.println("-1" + " " + "-1" + " " + "-1");
    } flag {
      System.out.println(a +" "+ b +" "+ c);
    } System.out.println(a +" "+ b +" "+ c) System.out.println System.out System System.out a +" "+ b +" "+ c " " b a +" "+ b +" "+ c a " " b " " c {
      System.out.println("-1" + " " + "-1" + " " + "-1");
    } System.out.println("-1" + " " + "-1" + " " + "-1") System.out.println System.out System System.out "-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 a = 0, b = 0, c = 0;
    boolean flag = false;
        for(int i=n;i>=0;i--){     
          for(int j=n-i;j>=0;j--){
              int k = n-i-j;
              int number = 10000 * i + 5000 * j + 1000 * k;
              if(number == y && i + j + k == n){
              	 a = i;
                 b = j;
                 c = k;
                 flag = true;
                
              
            }
          }
         }
    if(flag){
      System.out.println(a +" "+ b +" "+ c);
    }else{
      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 a = 0, b = 0, c = 0;
    boolean flag = false;
        for(int i=n;i>=0;i--){     
          for(int j=n-i;j>=0;j--){
              int k = n-i-j;
              int number = 10000 * i + 5000 * j + 1000 * k;
              if(number == y && i + j + k == n){
              	 a = i;
                 b = j;
                 c = k;
                 flag = true;
                
              
            }
          }
         }
    if(flag){
      System.out.println(a +" "+ b +" "+ c);
    }else{
      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 a = 0, b = 0, c = 0;
    boolean flag = false;
        for(int i=n;i>=0;i--){     
          for(int j=n-i;j>=0;j--){
              int k = n-i-j;
              int number = 10000 * i + 5000 * j + 1000 * k;
              if(number == y && i + j + k == n){
              	 a = i;
                 b = j;
                 c = k;
                 flag = true;
                
              
            }
          }
         }
    if(flag){
      System.out.println(a +" "+ b +" "+ c);
    }else{
      System.out.println("-1" + " " + "-1" + " " + "-1");
    }  
  }
}  