import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int x = -1;
    int y = -1;
    int z = -1;
    for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N - i; j++) {
        int sum = i * 10000 + j * 5000 + (N - i - j) * 1000;
        if (sum == Y) {
          x = i;
          y = j;
          z = N - i - j;
          break;
        }
      }
    }
    System.out.println(x + " " + y + " " + z);
  }
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int x = -1;
    int y = -1;
    int z = -1;
    for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N - i; j++) {
        int sum = i * 10000 + j * 5000 + (N - i - j) * 1000;
        if (sum == Y) {
          x = i;
          y = j;
          z = N - i - j;
          break;
        }
      }
    }
    System.out.println(x + " " + y + " " + z);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int x = -1;
    int y = -1;
    int z = -1;
    for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N - i; j++) {
        int sum = i * 10000 + j * 5000 + (N - i - j) * 1000;
        if (sum == Y) {
          x = i;
          y = j;
          z = N - i - j;
          break;
        }
      }
    }
    System.out.println(x + " " + y + " " + z);
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int x = -1;
    int y = -1;
    int z = -1;
    for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N - i; j++) {
        int sum = i * 10000 + j * 5000 + (N - i - j) * 1000;
        if (sum == Y) {
          x = i;
          y = j;
          z = N - i - j;
          break;
        }
      }
    }
    System.out.println(x + " " + y + " " + z);
  } 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 x = -1; x -1 1 int y = -1; y -1 1 int z = -1; z -1 1 for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N - i; j++) {
        int sum = i * 10000 + j * 5000 + (N - i - j) * 1000;
        if (sum == Y) {
          x = i;
          y = j;
          z = N - i - j;
          break;
        }
      }
    } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
      for (int j = 0; j <= N - i; j++) {
        int sum = i * 10000 + j * 5000 + (N - i - j) * 1000;
        if (sum == Y) {
          x = i;
          y = j;
          z = N - i - j;
          break;
        }
      }
    } {
      for (int j = 0; j <= N - i; j++) {
        int sum = i * 10000 + j * 5000 + (N - i - j) * 1000;
        if (sum == Y) {
          x = i;
          y = j;
          z = N - i - j;
          break;
        }
      }
    } for (int j = 0; j <= N - i; j++) {
        int sum = i * 10000 + j * 5000 + (N - i - j) * 1000;
        if (sum == Y) {
          x = i;
          y = j;
          z = N - i - j;
          break;
        }
      } int j = 0; int j = 0; j 0 j <= N - i j N - i N i j++ j++ j {
        int sum = i * 10000 + j * 5000 + (N - i - j) * 1000;
        if (sum == Y) {
          x = i;
          y = j;
          z = N - i - j;
          break;
        }
      } {
        int sum = i * 10000 + j * 5000 + (N - i - j) * 1000;
        if (sum == Y) {
          x = i;
          y = j;
          z = N - i - j;
          break;
        }
      } int sum = i * 10000 + j * 5000 + (N - i - j) * 1000; sum i * 10000 + j * 5000 + (N - i - j) * 1000 i * 10000 + j * 5000 + (N - i - j) * 1000 i * 10000 i 10000 j * 5000 j 5000 (N - i - j) * 1000 (N - i - j) N - i - j N i j 1000 if (sum == Y) {
          x = i;
          y = j;
          z = N - i - j;
          break;
        } sum == Y sum Y {
          x = i;
          y = j;
          z = N - i - j;
          break;
        } x = i x i y = j y j z = N - i - j z N - i - j N - i - j N i j break; System.out.println(x + " " + y + " " + z) System.out.println System.out System System.out x + " " + y + " " + z " " y x + " " + y + " " + z x " " y " " z String[] args args
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int x = -1;
    int y = -1;
    int z = -1;
    for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N - i; j++) {
        int sum = i * 10000 + j * 5000 + (N - i - j) * 1000;
        if (sum == Y) {
          x = i;
          y = j;
          z = N - i - j;
          break;
        }
      }
    }
    System.out.println(x + " " + y + " " + z);
  }
}