import java.util.*;
 
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int billCount = sc.nextInt();
    int sum = sc.nextInt();

    int man = 0,gosen = 0, sen=0;
    boolean flag = false;
    for(int i=0;i<=billCount;i++){
       for(int j=0;j<=billCount-i;j++){
            if(check(i,j,billCount-i-j,sum)){
                man = i;
                gosen = j;
                sen = billCount-i-j;
                flag = true;
            }
       }
    }
    
    if(flag){
      System.out.println(man + " " + gosen + " " + sen);    
    } else {
      System.out.println("-1 -1 -1");
    }
    
  }
  
  public static boolean check(int a,int b, int c, int sum){
      return sum == a * 10000 + b * 5000 + c * 1000;
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int billCount = sc.nextInt();
    int sum = sc.nextInt();

    int man = 0,gosen = 0, sen=0;
    boolean flag = false;
    for(int i=0;i<=billCount;i++){
       for(int j=0;j<=billCount-i;j++){
            if(check(i,j,billCount-i-j,sum)){
                man = i;
                gosen = j;
                sen = billCount-i-j;
                flag = true;
            }
       }
    }
    
    if(flag){
      System.out.println(man + " " + gosen + " " + sen);    
    } else {
      System.out.println("-1 -1 -1");
    }
    
  }
  
  public static boolean check(int a,int b, int c, int sum){
      return sum == a * 10000 + b * 5000 + c * 1000;
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int billCount = sc.nextInt();
    int sum = sc.nextInt();

    int man = 0,gosen = 0, sen=0;
    boolean flag = false;
    for(int i=0;i<=billCount;i++){
       for(int j=0;j<=billCount-i;j++){
            if(check(i,j,billCount-i-j,sum)){
                man = i;
                gosen = j;
                sen = billCount-i-j;
                flag = true;
            }
       }
    }
    
    if(flag){
      System.out.println(man + " " + gosen + " " + sen);    
    } else {
      System.out.println("-1 -1 -1");
    }
    
  } main {
    Scanner sc = new Scanner(System.in);
    int billCount = sc.nextInt();
    int sum = sc.nextInt();

    int man = 0,gosen = 0, sen=0;
    boolean flag = false;
    for(int i=0;i<=billCount;i++){
       for(int j=0;j<=billCount-i;j++){
            if(check(i,j,billCount-i-j,sum)){
                man = i;
                gosen = j;
                sen = billCount-i-j;
                flag = true;
            }
       }
    }
    
    if(flag){
      System.out.println(man + " " + gosen + " " + sen);    
    } else {
      System.out.println("-1 -1 -1");
    }
    
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int billCount = sc.nextInt(); billCount sc.nextInt() sc.nextInt sc int sum = sc.nextInt(); sum sc.nextInt() sc.nextInt sc int man = 0 man 0 gosen = 0 gosen 0 sen=0; sen 0 boolean flag = false; flag false for(int i=0;i<=billCount;i++){
       for(int j=0;j<=billCount-i;j++){
            if(check(i,j,billCount-i-j,sum)){
                man = i;
                gosen = j;
                sen = billCount-i-j;
                flag = true;
            }
       }
    } int i=0; int i=0; i 0 i<=billCount i billCount i++ i++ i {
       for(int j=0;j<=billCount-i;j++){
            if(check(i,j,billCount-i-j,sum)){
                man = i;
                gosen = j;
                sen = billCount-i-j;
                flag = true;
            }
       }
    } {
       for(int j=0;j<=billCount-i;j++){
            if(check(i,j,billCount-i-j,sum)){
                man = i;
                gosen = j;
                sen = billCount-i-j;
                flag = true;
            }
       }
    } for(int j=0;j<=billCount-i;j++){
            if(check(i,j,billCount-i-j,sum)){
                man = i;
                gosen = j;
                sen = billCount-i-j;
                flag = true;
            }
       } int j=0; int j=0; j 0 j<=billCount-i j billCount-i billCount i j++ j++ j {
            if(check(i,j,billCount-i-j,sum)){
                man = i;
                gosen = j;
                sen = billCount-i-j;
                flag = true;
            }
       } {
            if(check(i,j,billCount-i-j,sum)){
                man = i;
                gosen = j;
                sen = billCount-i-j;
                flag = true;
            }
       } if(check(i,j,billCount-i-j,sum)){
                man = i;
                gosen = j;
                sen = billCount-i-j;
                flag = true;
            } check(i,j,billCount-i-j,sum) check i j billCount-i-j billCount-i-j billCount i j sum {
                man = i;
                gosen = j;
                sen = billCount-i-j;
                flag = true;
            } man = i man i gosen = j gosen j sen = billCount-i-j sen billCount-i-j billCount-i-j billCount i j flag = true flag true if(flag){
      System.out.println(man + " " + gosen + " " + sen);    
    } else {
      System.out.println("-1 -1 -1");
    } flag {
      System.out.println(man + " " + gosen + " " + sen);    
    } System.out.println(man + " " + gosen + " " + sen) System.out.println System.out System System.out man + " " + gosen + " " + sen " " gosen man + " " + gosen + " " + sen man " " gosen " " sen {
      System.out.println("-1 -1 -1");
    } System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[] args args public static boolean check(int a,int b, int c, int sum){
      return sum == a * 10000 + b * 5000 + c * 1000;
  } check {
      return sum == a * 10000 + b * 5000 + c * 1000;
  } return sum == a * 10000 + b * 5000 + c * 1000; sum == a * 10000 + b * 5000 + c * 1000 sum a * 10000 + b * 5000 + c * 1000 a * 10000 + b * 5000 + c * 1000 a * 10000 a 10000 b * 5000 b 5000 c * 1000 c 1000 int a a int b b int c c int sum sum public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int billCount = sc.nextInt();
    int sum = sc.nextInt();

    int man = 0,gosen = 0, sen=0;
    boolean flag = false;
    for(int i=0;i<=billCount;i++){
       for(int j=0;j<=billCount-i;j++){
            if(check(i,j,billCount-i-j,sum)){
                man = i;
                gosen = j;
                sen = billCount-i-j;
                flag = true;
            }
       }
    }
    
    if(flag){
      System.out.println(man + " " + gosen + " " + sen);    
    } else {
      System.out.println("-1 -1 -1");
    }
    
  }
  
  public static boolean check(int a,int b, int c, int sum){
      return sum == a * 10000 + b * 5000 + c * 1000;
  }
} public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int billCount = sc.nextInt();
    int sum = sc.nextInt();

    int man = 0,gosen = 0, sen=0;
    boolean flag = false;
    for(int i=0;i<=billCount;i++){
       for(int j=0;j<=billCount-i;j++){
            if(check(i,j,billCount-i-j,sum)){
                man = i;
                gosen = j;
                sen = billCount-i-j;
                flag = true;
            }
       }
    }
    
    if(flag){
      System.out.println(man + " " + gosen + " " + sen);    
    } else {
      System.out.println("-1 -1 -1");
    }
    
  }
  
  public static boolean check(int a,int b, int c, int sum){
      return sum == a * 10000 + b * 5000 + c * 1000;
  }
} Main
import java.util.*;
 
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int billCount = sc.nextInt();
    int sum = sc.nextInt();

    int man = 0,gosen = 0, sen=0;
    boolean flag = false;
    for(int i=0;i<=billCount;i++){
       for(int j=0;j<=billCount-i;j++){
            if(check(i,j,billCount-i-j,sum)){
                man = i;
                gosen = j;
                sen = billCount-i-j;
                flag = true;
            }
       }
    }
    
    if(flag){
      System.out.println(man + " " + gosen + " " + sen);    
    } else {
      System.out.println("-1 -1 -1");
    }
    
  }
  
  public static boolean check(int a,int b, int c, int sum){
      return sum == a * 10000 + b * 5000 + c * 1000;
  }
}