import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int number, one, five, ten, value;
    boolean flag = true;
    number = Integer.parseInt(sc.next());
    value = Integer.parseInt(sc.next());
    for(ten = 0; ten <= number; ten++) {
      for(five = 0; five <= number - ten; five++) {
        one = number - ten - five;
        if(one * 1000 + five * 5000 + ten * 10000 == value) {
          flag = false;
          System.out.println(ten + " " + five + " " + one);
          return;
        }
      }
    }
    if(flag) 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 number, one, five, ten, value;
    boolean flag = true;
    number = Integer.parseInt(sc.next());
    value = Integer.parseInt(sc.next());
    for(ten = 0; ten <= number; ten++) {
      for(five = 0; five <= number - ten; five++) {
        one = number - ten - five;
        if(one * 1000 + five * 5000 + ten * 10000 == value) {
          flag = false;
          System.out.println(ten + " " + five + " " + one);
          return;
        }
      }
    }
    if(flag) System.out.println("-1 -1 -1");
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int number, one, five, ten, value;
    boolean flag = true;
    number = Integer.parseInt(sc.next());
    value = Integer.parseInt(sc.next());
    for(ten = 0; ten <= number; ten++) {
      for(five = 0; five <= number - ten; five++) {
        one = number - ten - five;
        if(one * 1000 + five * 5000 + ten * 10000 == value) {
          flag = false;
          System.out.println(ten + " " + five + " " + one);
          return;
        }
      }
    }
    if(flag) System.out.println("-1 -1 -1");
  } main {
    Scanner sc = new Scanner(System.in);
    int number, one, five, ten, value;
    boolean flag = true;
    number = Integer.parseInt(sc.next());
    value = Integer.parseInt(sc.next());
    for(ten = 0; ten <= number; ten++) {
      for(five = 0; five <= number - ten; five++) {
        one = number - ten - five;
        if(one * 1000 + five * 5000 + ten * 10000 == value) {
          flag = false;
          System.out.println(ten + " " + five + " " + one);
          return;
        }
      }
    }
    if(flag) System.out.println("-1 -1 -1");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int number number one one five five ten ten value; value boolean flag = true; flag true number = Integer.parseInt(sc.next()) number Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc value = Integer.parseInt(sc.next()) value Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc for(ten = 0; ten <= number; ten++) {
      for(five = 0; five <= number - ten; five++) {
        one = number - ten - five;
        if(one * 1000 + five * 5000 + ten * 10000 == value) {
          flag = false;
          System.out.println(ten + " " + five + " " + one);
          return;
        }
      }
    } ten = 0; ten = 0 ten 0 ten <= number ten number ten++ ten++ ten {
      for(five = 0; five <= number - ten; five++) {
        one = number - ten - five;
        if(one * 1000 + five * 5000 + ten * 10000 == value) {
          flag = false;
          System.out.println(ten + " " + five + " " + one);
          return;
        }
      }
    } {
      for(five = 0; five <= number - ten; five++) {
        one = number - ten - five;
        if(one * 1000 + five * 5000 + ten * 10000 == value) {
          flag = false;
          System.out.println(ten + " " + five + " " + one);
          return;
        }
      }
    } for(five = 0; five <= number - ten; five++) {
        one = number - ten - five;
        if(one * 1000 + five * 5000 + ten * 10000 == value) {
          flag = false;
          System.out.println(ten + " " + five + " " + one);
          return;
        }
      } five = 0; five = 0 five 0 five <= number - ten five number - ten number ten five++ five++ five {
        one = number - ten - five;
        if(one * 1000 + five * 5000 + ten * 10000 == value) {
          flag = false;
          System.out.println(ten + " " + five + " " + one);
          return;
        }
      } {
        one = number - ten - five;
        if(one * 1000 + five * 5000 + ten * 10000 == value) {
          flag = false;
          System.out.println(ten + " " + five + " " + one);
          return;
        }
      } one = number - ten - five one number - ten - five number - ten - five number ten five if(one * 1000 + five * 5000 + ten * 10000 == value) {
          flag = false;
          System.out.println(ten + " " + five + " " + one);
          return;
        } one * 1000 + five * 5000 + ten * 10000 == value one * 1000 + five * 5000 + ten * 10000 one * 1000 + five * 5000 + ten * 10000 one * 1000 one 1000 five * 5000 five 5000 ten * 10000 ten 10000 value {
          flag = false;
          System.out.println(ten + " " + five + " " + one);
          return;
        } flag = false flag false System.out.println(ten + " " + five + " " + one) System.out.println System.out System System.out ten + " " + five + " " + one " " five ten + " " + five + " " + one ten " " five " " one return; if(flag) System.out.println("-1 -1 -1"); flag 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 number, one, five, ten, value;
    boolean flag = true;
    number = Integer.parseInt(sc.next());
    value = Integer.parseInt(sc.next());
    for(ten = 0; ten <= number; ten++) {
      for(five = 0; five <= number - ten; five++) {
        one = number - ten - five;
        if(one * 1000 + five * 5000 + ten * 10000 == value) {
          flag = false;
          System.out.println(ten + " " + five + " " + one);
          return;
        }
      }
    }
    if(flag) System.out.println("-1 -1 -1");
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int number, one, five, ten, value;
    boolean flag = true;
    number = Integer.parseInt(sc.next());
    value = Integer.parseInt(sc.next());
    for(ten = 0; ten <= number; ten++) {
      for(five = 0; five <= number - ten; five++) {
        one = number - ten - five;
        if(one * 1000 + five * 5000 + ten * 10000 == value) {
          flag = false;
          System.out.println(ten + " " + five + " " + one);
          return;
        }
      }
    }
    if(flag) 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 number, one, five, ten, value;
    boolean flag = true;
    number = Integer.parseInt(sc.next());
    value = Integer.parseInt(sc.next());
    for(ten = 0; ten <= number; ten++) {
      for(five = 0; five <= number - ten; five++) {
        one = number - ten - five;
        if(one * 1000 + five * 5000 + ten * 10000 == value) {
          flag = false;
          System.out.println(ten + " " + five + " " + one);
          return;
        }
      }
    }
    if(flag) System.out.println("-1 -1 -1");
  }
}
