import java.util.*;

/**
 * C - Otoshidama
 */
public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int res10000 = -1, res5000 = -1, res1000 = -1;

    for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N - i; j++) {
        int cntRest = N - i - j; 
        // 残りのお札は全部1000円だから、3重ループしなくても金額が分かる
        int total = 10000 * i + 5000 * j + 1000 * cntRest;
        if (total == Y) {
          res10000 = i;
          res5000 = j;
          res1000 = cntRest;
        }
      }
    }

    System.out.println(res10000 + " " + res5000 + " " + res1000);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int res10000 = -1, res5000 = -1, res1000 = -1;

    for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N - i; j++) {
        int cntRest = N - i - j; 
        // 残りのお札は全部1000円だから、3重ループしなくても金額が分かる
        int total = 10000 * i + 5000 * j + 1000 * cntRest;
        if (total == Y) {
          res10000 = i;
          res5000 = j;
          res1000 = cntRest;
        }
      }
    }

    System.out.println(res10000 + " " + res5000 + " " + res1000);
  }
} Main public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int res10000 = -1, res5000 = -1, res1000 = -1;

    for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N - i; j++) {
        int cntRest = N - i - j; 
        // 残りのお札は全部1000円だから、3重ループしなくても金額が分かる
        int total = 10000 * i + 5000 * j + 1000 * cntRest;
        if (total == Y) {
          res10000 = i;
          res5000 = j;
          res1000 = cntRest;
        }
      }
    }

    System.out.println(res10000 + " " + res5000 + " " + res1000);
  } main {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int res10000 = -1, res5000 = -1, res1000 = -1;

    for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N - i; j++) {
        int cntRest = N - i - j; 
        // 残りのお札は全部1000円だから、3重ループしなくても金額が分かる
        int total = 10000 * i + 5000 * j + 1000 * cntRest;
        if (total == Y) {
          res10000 = i;
          res5000 = j;
          res1000 = cntRest;
        }
      }
    }

    System.out.println(res10000 + " " + res5000 + " " + res1000);
  } @SuppressWarnings("resource")
    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 res10000 = -1 res10000 -1 1 res5000 = -1 res5000 -1 1 res1000 = -1; res1000 -1 1 for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N - i; j++) {
        int cntRest = N - i - j; 
        // 残りのお札は全部1000円だから、3重ループしなくても金額が分かる
        int total = 10000 * i + 5000 * j + 1000 * cntRest;
        if (total == Y) {
          res10000 = i;
          res5000 = j;
          res1000 = cntRest;
        }
      }
    } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
      for (int j = 0; j <= N - i; j++) {
        int cntRest = N - i - j; 
        // 残りのお札は全部1000円だから、3重ループしなくても金額が分かる
        int total = 10000 * i + 5000 * j + 1000 * cntRest;
        if (total == Y) {
          res10000 = i;
          res5000 = j;
          res1000 = cntRest;
        }
      }
    } {
      for (int j = 0; j <= N - i; j++) {
        int cntRest = N - i - j; 
        // 残りのお札は全部1000円だから、3重ループしなくても金額が分かる
        int total = 10000 * i + 5000 * j + 1000 * cntRest;
        if (total == Y) {
          res10000 = i;
          res5000 = j;
          res1000 = cntRest;
        }
      }
    } for (int j = 0; j <= N - i; j++) {
        int cntRest = N - i - j; 
        // 残りのお札は全部1000円だから、3重ループしなくても金額が分かる
        int total = 10000 * i + 5000 * j + 1000 * cntRest;
        if (total == Y) {
          res10000 = i;
          res5000 = j;
          res1000 = cntRest;
        }
      } int j = 0; int j = 0; j 0 j <= N - i j N - i N i j++ j++ j {
        int cntRest = N - i - j; 
        // 残りのお札は全部1000円だから、3重ループしなくても金額が分かる
        int total = 10000 * i + 5000 * j + 1000 * cntRest;
        if (total == Y) {
          res10000 = i;
          res5000 = j;
          res1000 = cntRest;
        }
      } {
        int cntRest = N - i - j; 
        // 残りのお札は全部1000円だから、3重ループしなくても金額が分かる
        int total = 10000 * i + 5000 * j + 1000 * cntRest;
        if (total == Y) {
          res10000 = i;
          res5000 = j;
          res1000 = cntRest;
        }
      } int cntRest = N - i - j; cntRest N - i - j N - i - j N i j int total = 10000 * i + 5000 * j + 1000 * cntRest; total 10000 * i + 5000 * j + 1000 * cntRest 10000 * i + 5000 * j + 1000 * cntRest 10000 * i 10000 i 5000 * j 5000 j 1000 * cntRest 1000 cntRest if (total == Y) {
          res10000 = i;
          res5000 = j;
          res1000 = cntRest;
        } total == Y total Y {
          res10000 = i;
          res5000 = j;
          res1000 = cntRest;
        } res10000 = i res10000 i res5000 = j res5000 j res1000 = cntRest res1000 cntRest System.out.println(res10000 + " " + res5000 + " " + res1000) System.out.println System.out System System.out res10000 + " " + res5000 + " " + res1000 " " res5000 res10000 + " " + res5000 + " " + res1000 res10000 " " res5000 " " res1000 String[] args args public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int res10000 = -1, res5000 = -1, res1000 = -1;

    for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N - i; j++) {
        int cntRest = N - i - j; 
        // 残りのお札は全部1000円だから、3重ループしなくても金額が分かる
        int total = 10000 * i + 5000 * j + 1000 * cntRest;
        if (total == Y) {
          res10000 = i;
          res5000 = j;
          res1000 = cntRest;
        }
      }
    }

    System.out.println(res10000 + " " + res5000 + " " + res1000);
  }
} public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int res10000 = -1, res5000 = -1, res1000 = -1;

    for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N - i; j++) {
        int cntRest = N - i - j; 
        // 残りのお札は全部1000円だから、3重ループしなくても金額が分かる
        int total = 10000 * i + 5000 * j + 1000 * cntRest;
        if (total == Y) {
          res10000 = i;
          res5000 = j;
          res1000 = cntRest;
        }
      }
    }

    System.out.println(res10000 + " " + res5000 + " " + res1000);
  }
} Main
import java.util.*;

/**
 * C - Otoshidama
 */
public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    int res10000 = -1, res5000 = -1, res1000 = -1;

    for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N - i; j++) {
        int cntRest = N - i - j; 
        // 残りのお札は全部1000円だから、3重ループしなくても金額が分かる
        int total = 10000 * i + 5000 * j + 1000 * cntRest;
        if (total == Y) {
          res10000 = i;
          res5000 = j;
          res1000 = cntRest;
        }
      }
    }

    System.out.println(res10000 + " " + res5000 + " " + res1000);
  }
}