import java.util.*;

class Main {
  public static void main(String[] args) {
	Scanner scanner = new Scanner(System.in);
    
    int N = scanner.nextInt(); //next(文字列), nextDouble, nextLine(1行)とか
	int S = scanner.nextInt();
    
    int x = -1;int y= -1;int z = -1;
    for (int i = 0; i <= N; i++){
      x = i;
      for (int j = 0; j <= N-i; j++){
        y = j;
        z = N - i - j;
        if ((z >= 0) && (10000*x + 5000*y + 1000*z == S)){
          System.out.println(x + " " + y + " " + z);
          return;
        }
      }
    }
    System.out.println(-1 + " " + -1 + " " + -1);
  }
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
	Scanner scanner = new Scanner(System.in);
    
    int N = scanner.nextInt(); //next(文字列), nextDouble, nextLine(1行)とか
	int S = scanner.nextInt();
    
    int x = -1;int y= -1;int z = -1;
    for (int i = 0; i <= N; i++){
      x = i;
      for (int j = 0; j <= N-i; j++){
        y = j;
        z = N - i - j;
        if ((z >= 0) && (10000*x + 5000*y + 1000*z == S)){
          System.out.println(x + " " + y + " " + z);
          return;
        }
      }
    }
    System.out.println(-1 + " " + -1 + " " + -1);
  }
} Main public static void main(String[] args) {
	Scanner scanner = new Scanner(System.in);
    
    int N = scanner.nextInt(); //next(文字列), nextDouble, nextLine(1行)とか
	int S = scanner.nextInt();
    
    int x = -1;int y= -1;int z = -1;
    for (int i = 0; i <= N; i++){
      x = i;
      for (int j = 0; j <= N-i; j++){
        y = j;
        z = N - i - j;
        if ((z >= 0) && (10000*x + 5000*y + 1000*z == S)){
          System.out.println(x + " " + y + " " + z);
          return;
        }
      }
    }
    System.out.println(-1 + " " + -1 + " " + -1);
  } main {
	Scanner scanner = new Scanner(System.in);
    
    int N = scanner.nextInt(); //next(文字列), nextDouble, nextLine(1行)とか
	int S = scanner.nextInt();
    
    int x = -1;int y= -1;int z = -1;
    for (int i = 0; i <= N; i++){
      x = i;
      for (int j = 0; j <= N-i; j++){
        y = j;
        z = N - i - j;
        if ((z >= 0) && (10000*x + 5000*y + 1000*z == S)){
          System.out.println(x + " " + y + " " + z);
          return;
        }
      }
    }
    System.out.println(-1 + " " + -1 + " " + -1);
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int S = scanner.nextInt(); S scanner.nextInt() scanner.nextInt scanner int x = -1; x -1 1 int y= -1; y -1 1 int z = -1; z -1 1 for (int i = 0; i <= N; i++){
      x = i;
      for (int j = 0; j <= N-i; j++){
        y = j;
        z = N - i - j;
        if ((z >= 0) && (10000*x + 5000*y + 1000*z == S)){
          System.out.println(x + " " + y + " " + z);
          return;
        }
      }
    } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
      x = i;
      for (int j = 0; j <= N-i; j++){
        y = j;
        z = N - i - j;
        if ((z >= 0) && (10000*x + 5000*y + 1000*z == S)){
          System.out.println(x + " " + y + " " + z);
          return;
        }
      }
    } {
      x = i;
      for (int j = 0; j <= N-i; j++){
        y = j;
        z = N - i - j;
        if ((z >= 0) && (10000*x + 5000*y + 1000*z == S)){
          System.out.println(x + " " + y + " " + z);
          return;
        }
      }
    } x = i x i for (int j = 0; j <= N-i; j++){
        y = j;
        z = N - i - j;
        if ((z >= 0) && (10000*x + 5000*y + 1000*z == S)){
          System.out.println(x + " " + y + " " + z);
          return;
        }
      } int j = 0; int j = 0; j 0 j <= N-i j N-i N i j++ j++ j {
        y = j;
        z = N - i - j;
        if ((z >= 0) && (10000*x + 5000*y + 1000*z == S)){
          System.out.println(x + " " + y + " " + z);
          return;
        }
      } {
        y = j;
        z = N - i - j;
        if ((z >= 0) && (10000*x + 5000*y + 1000*z == S)){
          System.out.println(x + " " + y + " " + z);
          return;
        }
      } y = j y j z = N - i - j z N - i - j N - i - j N i j if ((z >= 0) && (10000*x + 5000*y + 1000*z == S)){
          System.out.println(x + " " + y + " " + z);
          return;
        } (z >= 0) && (10000*x + 5000*y + 1000*z == S) (z >= 0) z 0 (10000*x + 5000*y + 1000*z == S) 10000*x + 5000*y + 1000*z 10000*x + 5000*y + 1000*z 10000*x 10000 x 5000*y 5000 y 1000*z 1000 z S {
          System.out.println(x + " " + y + " " + z);
          return;
        } System.out.println(x + " " + y + " " + z) System.out.println 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 " " -1 -1 + " " + -1 + " " + -1 -1 1 " " -1 1 " " -1 1 String[] args args
import java.util.*;

class Main {
  public static void main(String[] args) {
	Scanner scanner = new Scanner(System.in);
    
    int N = scanner.nextInt(); //next(文字列), nextDouble, nextLine(1行)とか
	int S = scanner.nextInt();
    
    int x = -1;int y= -1;int z = -1;
    for (int i = 0; i <= N; i++){
      x = i;
      for (int j = 0; j <= N-i; j++){
        y = j;
        z = N - i - j;
        if ((z >= 0) && (10000*x + 5000*y + 1000*z == S)){
          System.out.println(x + " " + y + " " + z);
          return;
        }
      }
    }
    System.out.println(-1 + " " + -1 + " " + -1);
  }
}
