import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);

        int billCount = sc.nextInt();
        int answerAmount = sc.nextInt();
        
        for (int i = 0; i <= billCount; i++) {
            for (int j = 0; j <= billCount - i; j++) {
                int k = billCount - i - j;
                int amount = 10000 * i + 5000 * j + 1000 * k;
                if (amount == answerAmount) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }
        
        System.out.println(-1 + " " + -1 + " " + -1);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);

        int billCount = sc.nextInt();
        int answerAmount = sc.nextInt();
        
        for (int i = 0; i <= billCount; i++) {
            for (int j = 0; j <= billCount - i; j++) {
                int k = billCount - i - j;
                int amount = 10000 * i + 5000 * j + 1000 * k;
                if (amount == answerAmount) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }
        
        System.out.println(-1 + " " + -1 + " " + -1);
    }
} Main public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);

        int billCount = sc.nextInt();
        int answerAmount = sc.nextInt();
        
        for (int i = 0; i <= billCount; i++) {
            for (int j = 0; j <= billCount - i; j++) {
                int k = billCount - i - j;
                int amount = 10000 * i + 5000 * j + 1000 * k;
                if (amount == answerAmount) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }
        
        System.out.println(-1 + " " + -1 + " " + -1);
    } main {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);

        int billCount = sc.nextInt();
        int answerAmount = sc.nextInt();
        
        for (int i = 0; i <= billCount; i++) {
            for (int j = 0; j <= billCount - i; j++) {
                int k = billCount - i - j;
                int amount = 10000 * i + 5000 * j + 1000 * k;
                if (amount == answerAmount) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }
        
        System.out.println(-1 + " " + -1 + " " + -1);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int billCount = sc.nextInt(); billCount sc.nextInt() sc.nextInt sc int answerAmount = sc.nextInt(); answerAmount sc.nextInt() sc.nextInt sc for (int i = 0; i <= billCount; i++) {
            for (int j = 0; j <= billCount - i; j++) {
                int k = billCount - i - j;
                int amount = 10000 * i + 5000 * j + 1000 * k;
                if (amount == answerAmount) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        } int i = 0; int i = 0; i 0 i <= billCount i billCount i++ i++ i {
            for (int j = 0; j <= billCount - i; j++) {
                int k = billCount - i - j;
                int amount = 10000 * i + 5000 * j + 1000 * k;
                if (amount == answerAmount) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        } {
            for (int j = 0; j <= billCount - i; j++) {
                int k = billCount - i - j;
                int amount = 10000 * i + 5000 * j + 1000 * k;
                if (amount == answerAmount) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        } for (int j = 0; j <= billCount - i; j++) {
                int k = billCount - i - j;
                int amount = 10000 * i + 5000 * j + 1000 * k;
                if (amount == answerAmount) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            } int j = 0; int j = 0; j 0 j <= billCount - i j billCount - i billCount i j++ j++ j {
                int k = billCount - i - j;
                int amount = 10000 * i + 5000 * j + 1000 * k;
                if (amount == answerAmount) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            } {
                int k = billCount - i - j;
                int amount = 10000 * i + 5000 * j + 1000 * k;
                if (amount == answerAmount) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            } int k = billCount - i - j; k billCount - i - j billCount - i - j billCount i j int amount = 10000 * i + 5000 * j + 1000 * k; amount 10000 * i + 5000 * j + 1000 * k 10000 * i + 5000 * j + 1000 * k 10000 * i 10000 i 5000 * j 5000 j 1000 * k 1000 k if (amount == answerAmount) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                } amount == answerAmount amount answerAmount {
                    System.out.println(i + " " + j + " " + k);
                    return;
                } System.out.println(i + " " + j + " " + k) System.out.println System.out System System.out i + " " + j + " " + k " " j i + " " + j + " " + k i " " j " " k 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 public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);

        int billCount = sc.nextInt();
        int answerAmount = sc.nextInt();
        
        for (int i = 0; i <= billCount; i++) {
            for (int j = 0; j <= billCount - i; j++) {
                int k = billCount - i - j;
                int amount = 10000 * i + 5000 * j + 1000 * k;
                if (amount == answerAmount) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }
        
        System.out.println(-1 + " " + -1 + " " + -1);
    }
} public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);

        int billCount = sc.nextInt();
        int answerAmount = sc.nextInt();
        
        for (int i = 0; i <= billCount; i++) {
            for (int j = 0; j <= billCount - i; j++) {
                int k = billCount - i - j;
                int amount = 10000 * i + 5000 * j + 1000 * k;
                if (amount == answerAmount) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }
        
        System.out.println(-1 + " " + -1 + " " + -1);
    }
} Main
import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);

        int billCount = sc.nextInt();
        int answerAmount = sc.nextInt();
        
        for (int i = 0; i <= billCount; i++) {
            for (int j = 0; j <= billCount - i; j++) {
                int k = billCount - i - j;
                int amount = 10000 * i + 5000 * j + 1000 * k;
                if (amount == answerAmount) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }
        
        System.out.println(-1 + " " + -1 + " " + -1);
    }
}