import java.util.*;
import static java.lang.System.*;

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    Scanner sc = new Scanner(in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int x,y,z;
    int tmp;
    String ans = "-1 -1 -1";
    boolean check = true;
    for(x=0; x<=N; x++){
      if(check == false) break;
      for(y=0; y<=N-x; y++){
        z = N-x-y;
        tmp = 10000*x + 5000*y + 1000*z;
        if(tmp == Y){
          ans = x + " " + y + " " + z;
          check = false;
          break;
        }
      }
    }
    out.println(ans);
  }

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
} import java.util.*; util.* java import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    Scanner sc = new Scanner(in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int x,y,z;
    int tmp;
    String ans = "-1 -1 -1";
    boolean check = true;
    for(x=0; x<=N; x++){
      if(check == false) break;
      for(y=0; y<=N-x; y++){
        z = N-x-y;
        tmp = 10000*x + 5000*y + 1000*z;
        if(tmp == Y){
          ans = x + " " + y + " " + z;
          check = false;
          break;
        }
      }
    }
    out.println(ans);
  }

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
} Main public static final int MOD = 1000000007; MOD 1000000007 public static final int INF = 1000000000; INF 1000000000 public static void main(String[] args) {
    Scanner sc = new Scanner(in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int x,y,z;
    int tmp;
    String ans = "-1 -1 -1";
    boolean check = true;
    for(x=0; x<=N; x++){
      if(check == false) break;
      for(y=0; y<=N-x; y++){
        z = N-x-y;
        tmp = 10000*x + 5000*y + 1000*z;
        if(tmp == Y){
          ans = x + " " + y + " " + z;
          check = false;
          break;
        }
      }
    }
    out.println(ans);
  } main {
    Scanner sc = new Scanner(in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int x,y,z;
    int tmp;
    String ans = "-1 -1 -1";
    boolean check = true;
    for(x=0; x<=N; x++){
      if(check == false) break;
      for(y=0; y<=N-x; y++){
        z = N-x-y;
        tmp = 10000*x + 5000*y + 1000*z;
        if(tmp == Y){
          ans = x + " " + y + " " + z;
          check = false;
          break;
        }
      }
    }
    out.println(ans);
  } Scanner sc = new Scanner(in); sc new Scanner(in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int Y = sc.nextInt(); Y sc.nextInt() sc.nextInt sc int x x y y z; z int tmp; tmp String ans = "-1 -1 -1"; ans "-1 -1 -1" boolean check = true; check true for(x=0; x<=N; x++){
      if(check == false) break;
      for(y=0; y<=N-x; y++){
        z = N-x-y;
        tmp = 10000*x + 5000*y + 1000*z;
        if(tmp == Y){
          ans = x + " " + y + " " + z;
          check = false;
          break;
        }
      }
    } x=0; x=0 x 0 x<=N x N x++ x++ x {
      if(check == false) break;
      for(y=0; y<=N-x; y++){
        z = N-x-y;
        tmp = 10000*x + 5000*y + 1000*z;
        if(tmp == Y){
          ans = x + " " + y + " " + z;
          check = false;
          break;
        }
      }
    } {
      if(check == false) break;
      for(y=0; y<=N-x; y++){
        z = N-x-y;
        tmp = 10000*x + 5000*y + 1000*z;
        if(tmp == Y){
          ans = x + " " + y + " " + z;
          check = false;
          break;
        }
      }
    } if(check == false) break; check == false check false break; for(y=0; y<=N-x; y++){
        z = N-x-y;
        tmp = 10000*x + 5000*y + 1000*z;
        if(tmp == Y){
          ans = x + " " + y + " " + z;
          check = false;
          break;
        }
      } y=0; y=0 y 0 y<=N-x y N-x N x y++ y++ y {
        z = N-x-y;
        tmp = 10000*x + 5000*y + 1000*z;
        if(tmp == Y){
          ans = x + " " + y + " " + z;
          check = false;
          break;
        }
      } {
        z = N-x-y;
        tmp = 10000*x + 5000*y + 1000*z;
        if(tmp == Y){
          ans = x + " " + y + " " + z;
          check = false;
          break;
        }
      } z = N-x-y z N-x-y N-x-y N x y tmp = 10000*x + 5000*y + 1000*z tmp 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(tmp == Y){
          ans = x + " " + y + " " + z;
          check = false;
          break;
        } tmp == Y tmp Y {
          ans = x + " " + y + " " + z;
          check = false;
          break;
        } ans = x + " " + y + " " + z ans x + " " + y + " " + z " " y x + " " + y + " " + z x " " y " " z check = false check false break; out.println(ans) out.println out ans String[] args args public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  } gcd {
    if(b == 0) return a;
    return gcd(b, a%b);
  } if(b == 0) return a; b == 0 b 0 return a; a return gcd(b, a%b); gcd(b, a%b) gcd b a%b a b int a a int b b
import java.util.*;
import static java.lang.System.*;

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    Scanner sc = new Scanner(in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int x,y,z;
    int tmp;
    String ans = "-1 -1 -1";
    boolean check = true;
    for(x=0; x<=N; x++){
      if(check == false) break;
      for(y=0; y<=N-x; y++){
        z = N-x-y;
        tmp = 10000*x + 5000*y + 1000*z;
        if(tmp == Y){
          ans = x + " " + y + " " + z;
          check = false;
          break;
        }
      }
    }
    out.println(ans);
  }

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
}