import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    for (int num10000 = 0; num10000 <= N && num10000 * 10000 <= Y; num10000++) {
      for (int num5000 = 0; num5000 + num10000 <= N && (num10000 * 10000 + num5000 * 5000) <= Y; num5000++) {
        int remainder = Y - (num10000 * 10000 + num5000 * 5000);
        if (remainder % 1000 == 0 && (remainder / 1000) + num10000 + num5000 == N) {
          System.out.println(num10000 + " " + num5000 + " " + remainder / 1000);
          return;
        }
      }
    }
    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 N = sc.nextInt();
    int Y = sc.nextInt();
    for (int num10000 = 0; num10000 <= N && num10000 * 10000 <= Y; num10000++) {
      for (int num5000 = 0; num5000 + num10000 <= N && (num10000 * 10000 + num5000 * 5000) <= Y; num5000++) {
        int remainder = Y - (num10000 * 10000 + num5000 * 5000);
        if (remainder % 1000 == 0 && (remainder / 1000) + num10000 + num5000 == N) {
          System.out.println(num10000 + " " + num5000 + " " + remainder / 1000);
          return;
        }
      }
    }
    System.out.println("-1 -1 -1");
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    for (int num10000 = 0; num10000 <= N && num10000 * 10000 <= Y; num10000++) {
      for (int num5000 = 0; num5000 + num10000 <= N && (num10000 * 10000 + num5000 * 5000) <= Y; num5000++) {
        int remainder = Y - (num10000 * 10000 + num5000 * 5000);
        if (remainder % 1000 == 0 && (remainder / 1000) + num10000 + num5000 == N) {
          System.out.println(num10000 + " " + num5000 + " " + remainder / 1000);
          return;
        }
      }
    }
    System.out.println("-1 -1 -1");
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    for (int num10000 = 0; num10000 <= N && num10000 * 10000 <= Y; num10000++) {
      for (int num5000 = 0; num5000 + num10000 <= N && (num10000 * 10000 + num5000 * 5000) <= Y; num5000++) {
        int remainder = Y - (num10000 * 10000 + num5000 * 5000);
        if (remainder % 1000 == 0 && (remainder / 1000) + num10000 + num5000 == N) {
          System.out.println(num10000 + " " + num5000 + " " + remainder / 1000);
          return;
        }
      }
    }
    System.out.println("-1 -1 -1");
  } 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 for (int num10000 = 0; num10000 <= N && num10000 * 10000 <= Y; num10000++) {
      for (int num5000 = 0; num5000 + num10000 <= N && (num10000 * 10000 + num5000 * 5000) <= Y; num5000++) {
        int remainder = Y - (num10000 * 10000 + num5000 * 5000);
        if (remainder % 1000 == 0 && (remainder / 1000) + num10000 + num5000 == N) {
          System.out.println(num10000 + " " + num5000 + " " + remainder / 1000);
          return;
        }
      }
    } int num10000 = 0; int num10000 = 0; num10000 0 num10000 <= N && num10000 * 10000 <= Y num10000 <= N num10000 N num10000 * 10000 <= Y num10000 * 10000 num10000 10000 Y num10000++ num10000++ num10000 {
      for (int num5000 = 0; num5000 + num10000 <= N && (num10000 * 10000 + num5000 * 5000) <= Y; num5000++) {
        int remainder = Y - (num10000 * 10000 + num5000 * 5000);
        if (remainder % 1000 == 0 && (remainder / 1000) + num10000 + num5000 == N) {
          System.out.println(num10000 + " " + num5000 + " " + remainder / 1000);
          return;
        }
      }
    } {
      for (int num5000 = 0; num5000 + num10000 <= N && (num10000 * 10000 + num5000 * 5000) <= Y; num5000++) {
        int remainder = Y - (num10000 * 10000 + num5000 * 5000);
        if (remainder % 1000 == 0 && (remainder / 1000) + num10000 + num5000 == N) {
          System.out.println(num10000 + " " + num5000 + " " + remainder / 1000);
          return;
        }
      }
    } for (int num5000 = 0; num5000 + num10000 <= N && (num10000 * 10000 + num5000 * 5000) <= Y; num5000++) {
        int remainder = Y - (num10000 * 10000 + num5000 * 5000);
        if (remainder % 1000 == 0 && (remainder / 1000) + num10000 + num5000 == N) {
          System.out.println(num10000 + " " + num5000 + " " + remainder / 1000);
          return;
        }
      } int num5000 = 0; int num5000 = 0; num5000 0 num5000 + num10000 <= N && (num10000 * 10000 + num5000 * 5000) <= Y num5000 + num10000 <= N num5000 + num10000 num5000 num10000 N (num10000 * 10000 + num5000 * 5000) <= Y (num10000 * 10000 + num5000 * 5000) num10000 * 10000 num10000 10000 num5000 * 5000 num5000 5000 Y num5000++ num5000++ num5000 {
        int remainder = Y - (num10000 * 10000 + num5000 * 5000);
        if (remainder % 1000 == 0 && (remainder / 1000) + num10000 + num5000 == N) {
          System.out.println(num10000 + " " + num5000 + " " + remainder / 1000);
          return;
        }
      } {
        int remainder = Y - (num10000 * 10000 + num5000 * 5000);
        if (remainder % 1000 == 0 && (remainder / 1000) + num10000 + num5000 == N) {
          System.out.println(num10000 + " " + num5000 + " " + remainder / 1000);
          return;
        }
      } int remainder = Y - (num10000 * 10000 + num5000 * 5000); remainder Y - (num10000 * 10000 + num5000 * 5000) Y (num10000 * 10000 + num5000 * 5000) num10000 * 10000 num10000 10000 num5000 * 5000 num5000 5000 if (remainder % 1000 == 0 && (remainder / 1000) + num10000 + num5000 == N) {
          System.out.println(num10000 + " " + num5000 + " " + remainder / 1000);
          return;
        } remainder % 1000 == 0 && (remainder / 1000) + num10000 + num5000 == N remainder % 1000 == 0 remainder % 1000 remainder 1000 0 (remainder / 1000) + num10000 + num5000 == N (remainder / 1000) + num10000 + num5000 (remainder / 1000) + num10000 + num5000 (remainder / 1000) remainder 1000 num10000 num5000 N {
          System.out.println(num10000 + " " + num5000 + " " + remainder / 1000);
          return;
        } System.out.println(num10000 + " " + num5000 + " " + remainder / 1000) System.out.println System.out System System.out num10000 + " " + num5000 + " " + remainder / 1000 " " num5000 num10000 + " " + num5000 + " " + remainder / 1000 num10000 " " num5000 " " remainder / 1000 remainder 1000 return; 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 N = sc.nextInt();
    int Y = sc.nextInt();
    for (int num10000 = 0; num10000 <= N && num10000 * 10000 <= Y; num10000++) {
      for (int num5000 = 0; num5000 + num10000 <= N && (num10000 * 10000 + num5000 * 5000) <= Y; num5000++) {
        int remainder = Y - (num10000 * 10000 + num5000 * 5000);
        if (remainder % 1000 == 0 && (remainder / 1000) + num10000 + num5000 == N) {
          System.out.println(num10000 + " " + num5000 + " " + remainder / 1000);
          return;
        }
      }
    }
    System.out.println("-1 -1 -1");
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    for (int num10000 = 0; num10000 <= N && num10000 * 10000 <= Y; num10000++) {
      for (int num5000 = 0; num5000 + num10000 <= N && (num10000 * 10000 + num5000 * 5000) <= Y; num5000++) {
        int remainder = Y - (num10000 * 10000 + num5000 * 5000);
        if (remainder % 1000 == 0 && (remainder / 1000) + num10000 + num5000 == N) {
          System.out.println(num10000 + " " + num5000 + " " + remainder / 1000);
          return;
        }
      }
    }
    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 N = sc.nextInt();
    int Y = sc.nextInt();
    for (int num10000 = 0; num10000 <= N && num10000 * 10000 <= Y; num10000++) {
      for (int num5000 = 0; num5000 + num10000 <= N && (num10000 * 10000 + num5000 * 5000) <= Y; num5000++) {
        int remainder = Y - (num10000 * 10000 + num5000 * 5000);
        if (remainder % 1000 == 0 && (remainder / 1000) + num10000 + num5000 == N) {
          System.out.println(num10000 + " " + num5000 + " " + remainder / 1000);
          return;
        }
      }
    }
    System.out.println("-1 -1 -1");
  }
}
