import java.util.Scanner;

public class Main {

    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        int paramN = sc.nextInt();
        int paramY = sc.nextInt();
        System.out.println(judgeOtoshidama(paramN, paramY));
        sc.close();
    }

    public static String judgeOtoshidama(int N, int Y){
        for(int cnt10=0; cnt10<=N; cnt10++){
            for(int cnt5=0; cnt5<=N-cnt10; cnt5++){
                int cnt1 = N - (cnt10 + cnt5);
                if(Y == (cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000)){
                    return cnt10 + " " + cnt5 + " " + cnt1;
                }
            }
        }
        return "-1 -1 -1";
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        int paramN = sc.nextInt();
        int paramY = sc.nextInt();
        System.out.println(judgeOtoshidama(paramN, paramY));
        sc.close();
    }

    public static String judgeOtoshidama(int N, int Y){
        for(int cnt10=0; cnt10<=N; cnt10++){
            for(int cnt5=0; cnt5<=N-cnt10; cnt5++){
                int cnt1 = N - (cnt10 + cnt5);
                if(Y == (cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000)){
                    return cnt10 + " " + cnt5 + " " + cnt1;
                }
            }
        }
        return "-1 -1 -1";
    }
} Main public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        int paramN = sc.nextInt();
        int paramY = sc.nextInt();
        System.out.println(judgeOtoshidama(paramN, paramY));
        sc.close();
    } main {
        final Scanner sc = new Scanner(System.in);
        int paramN = sc.nextInt();
        int paramY = sc.nextInt();
        System.out.println(judgeOtoshidama(paramN, paramY));
        sc.close();
    } final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int paramN = sc.nextInt(); paramN sc.nextInt() sc.nextInt sc int paramY = sc.nextInt(); paramY sc.nextInt() sc.nextInt sc System.out.println(judgeOtoshidama(paramN, paramY)) System.out.println System.out System System.out judgeOtoshidama(paramN, paramY) judgeOtoshidama paramN paramY sc.close() sc.close sc final String[] args args public static String judgeOtoshidama(int N, int Y){
        for(int cnt10=0; cnt10<=N; cnt10++){
            for(int cnt5=0; cnt5<=N-cnt10; cnt5++){
                int cnt1 = N - (cnt10 + cnt5);
                if(Y == (cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000)){
                    return cnt10 + " " + cnt5 + " " + cnt1;
                }
            }
        }
        return "-1 -1 -1";
    } judgeOtoshidama {
        for(int cnt10=0; cnt10<=N; cnt10++){
            for(int cnt5=0; cnt5<=N-cnt10; cnt5++){
                int cnt1 = N - (cnt10 + cnt5);
                if(Y == (cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000)){
                    return cnt10 + " " + cnt5 + " " + cnt1;
                }
            }
        }
        return "-1 -1 -1";
    } for(int cnt10=0; cnt10<=N; cnt10++){
            for(int cnt5=0; cnt5<=N-cnt10; cnt5++){
                int cnt1 = N - (cnt10 + cnt5);
                if(Y == (cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000)){
                    return cnt10 + " " + cnt5 + " " + cnt1;
                }
            }
        } int cnt10=0; int cnt10=0; cnt10 0 cnt10<=N cnt10 N cnt10++ cnt10++ cnt10 {
            for(int cnt5=0; cnt5<=N-cnt10; cnt5++){
                int cnt1 = N - (cnt10 + cnt5);
                if(Y == (cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000)){
                    return cnt10 + " " + cnt5 + " " + cnt1;
                }
            }
        } {
            for(int cnt5=0; cnt5<=N-cnt10; cnt5++){
                int cnt1 = N - (cnt10 + cnt5);
                if(Y == (cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000)){
                    return cnt10 + " " + cnt5 + " " + cnt1;
                }
            }
        } for(int cnt5=0; cnt5<=N-cnt10; cnt5++){
                int cnt1 = N - (cnt10 + cnt5);
                if(Y == (cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000)){
                    return cnt10 + " " + cnt5 + " " + cnt1;
                }
            } int cnt5=0; int cnt5=0; cnt5 0 cnt5<=N-cnt10 cnt5 N-cnt10 N cnt10 cnt5++ cnt5++ cnt5 {
                int cnt1 = N - (cnt10 + cnt5);
                if(Y == (cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000)){
                    return cnt10 + " " + cnt5 + " " + cnt1;
                }
            } {
                int cnt1 = N - (cnt10 + cnt5);
                if(Y == (cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000)){
                    return cnt10 + " " + cnt5 + " " + cnt1;
                }
            } int cnt1 = N - (cnt10 + cnt5); cnt1 N - (cnt10 + cnt5) N (cnt10 + cnt5) cnt10 cnt5 if(Y == (cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000)){
                    return cnt10 + " " + cnt5 + " " + cnt1;
                } Y == (cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000) Y (cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000) cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000 cnt10 * 10000 cnt10 10000 cnt5 * 5000 cnt5 5000 cnt1 * 1000 cnt1 1000 {
                    return cnt10 + " " + cnt5 + " " + cnt1;
                } return cnt10 + " " + cnt5 + " " + cnt1; cnt10 + " " + cnt5 + " " + cnt1 " " cnt5 cnt10 + " " + cnt5 + " " + cnt1 cnt10 " " cnt5 " " cnt1 return "-1 -1 -1"; "-1 -1 -1" int N N int Y Y public class Main {

    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        int paramN = sc.nextInt();
        int paramY = sc.nextInt();
        System.out.println(judgeOtoshidama(paramN, paramY));
        sc.close();
    }

    public static String judgeOtoshidama(int N, int Y){
        for(int cnt10=0; cnt10<=N; cnt10++){
            for(int cnt5=0; cnt5<=N-cnt10; cnt5++){
                int cnt1 = N - (cnt10 + cnt5);
                if(Y == (cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000)){
                    return cnt10 + " " + cnt5 + " " + cnt1;
                }
            }
        }
        return "-1 -1 -1";
    }
} public class Main {

    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        int paramN = sc.nextInt();
        int paramY = sc.nextInt();
        System.out.println(judgeOtoshidama(paramN, paramY));
        sc.close();
    }

    public static String judgeOtoshidama(int N, int Y){
        for(int cnt10=0; cnt10<=N; cnt10++){
            for(int cnt5=0; cnt5<=N-cnt10; cnt5++){
                int cnt1 = N - (cnt10 + cnt5);
                if(Y == (cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000)){
                    return cnt10 + " " + cnt5 + " " + cnt1;
                }
            }
        }
        return "-1 -1 -1";
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        int paramN = sc.nextInt();
        int paramY = sc.nextInt();
        System.out.println(judgeOtoshidama(paramN, paramY));
        sc.close();
    }

    public static String judgeOtoshidama(int N, int Y){
        for(int cnt10=0; cnt10<=N; cnt10++){
            for(int cnt5=0; cnt5<=N-cnt10; cnt5++){
                int cnt1 = N - (cnt10 + cnt5);
                if(Y == (cnt10 * 10000 + cnt5 * 5000 + cnt1 * 1000)){
                    return cnt10 + " " + cnt5 + " " + cnt1;
                }
            }
        }
        return "-1 -1 -1";
    }
}