// "static void main" must be defined in a public class.
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int Y = scan.nextInt();
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N; j++){
                if((i*10000 + j*5000 + (N-i-j)*1000) == Y && (N-i-j) >= 0){
                    System.out.println(i + " " + j + " " + (N-i-j));
                    return;
                }else if((N-i-j) < 0){
                    break;
                }
            }
        }
        System.out.println(-1 + " " + -1 + " " + -1);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int Y = scan.nextInt();
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N; j++){
                if((i*10000 + j*5000 + (N-i-j)*1000) == Y && (N-i-j) >= 0){
                    System.out.println(i + " " + j + " " + (N-i-j));
                    return;
                }else if((N-i-j) < 0){
                    break;
                }
            }
        }
        System.out.println(-1 + " " + -1 + " " + -1);
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int Y = scan.nextInt();
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N; j++){
                if((i*10000 + j*5000 + (N-i-j)*1000) == Y && (N-i-j) >= 0){
                    System.out.println(i + " " + j + " " + (N-i-j));
                    return;
                }else if((N-i-j) < 0){
                    break;
                }
            }
        }
        System.out.println(-1 + " " + -1 + " " + -1);
    } main {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int Y = scan.nextInt();
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N; j++){
                if((i*10000 + j*5000 + (N-i-j)*1000) == Y && (N-i-j) >= 0){
                    System.out.println(i + " " + j + " " + (N-i-j));
                    return;
                }else if((N-i-j) < 0){
                    break;
                }
            }
        }
        System.out.println(-1 + " " + -1 + " " + -1);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int Y = scan.nextInt(); Y scan.nextInt() scan.nextInt scan for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N; j++){
                if((i*10000 + j*5000 + (N-i-j)*1000) == Y && (N-i-j) >= 0){
                    System.out.println(i + " " + j + " " + (N-i-j));
                    return;
                }else if((N-i-j) < 0){
                    break;
                }
            }
        } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
            for(int j = 0; j <= N; j++){
                if((i*10000 + j*5000 + (N-i-j)*1000) == Y && (N-i-j) >= 0){
                    System.out.println(i + " " + j + " " + (N-i-j));
                    return;
                }else if((N-i-j) < 0){
                    break;
                }
            }
        } {
            for(int j = 0; j <= N; j++){
                if((i*10000 + j*5000 + (N-i-j)*1000) == Y && (N-i-j) >= 0){
                    System.out.println(i + " " + j + " " + (N-i-j));
                    return;
                }else if((N-i-j) < 0){
                    break;
                }
            }
        } for(int j = 0; j <= N; j++){
                if((i*10000 + j*5000 + (N-i-j)*1000) == Y && (N-i-j) >= 0){
                    System.out.println(i + " " + j + " " + (N-i-j));
                    return;
                }else if((N-i-j) < 0){
                    break;
                }
            } int j = 0; int j = 0; j 0 j <= N j N j++ j++ j {
                if((i*10000 + j*5000 + (N-i-j)*1000) == Y && (N-i-j) >= 0){
                    System.out.println(i + " " + j + " " + (N-i-j));
                    return;
                }else if((N-i-j) < 0){
                    break;
                }
            } {
                if((i*10000 + j*5000 + (N-i-j)*1000) == Y && (N-i-j) >= 0){
                    System.out.println(i + " " + j + " " + (N-i-j));
                    return;
                }else if((N-i-j) < 0){
                    break;
                }
            } if((i*10000 + j*5000 + (N-i-j)*1000) == Y && (N-i-j) >= 0){
                    System.out.println(i + " " + j + " " + (N-i-j));
                    return;
                }else if((N-i-j) < 0){
                    break;
                } (i*10000 + j*5000 + (N-i-j)*1000) == Y && (N-i-j) >= 0 (i*10000 + j*5000 + (N-i-j)*1000) == Y (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 Y (N-i-j) >= 0 (N-i-j) N-i-j N i j 0 {
                    System.out.println(i + " " + j + " " + (N-i-j));
                    return;
                } System.out.println(i + " " + j + " " + (N-i-j)) System.out.println System.out System System.out i + " " + j + " " + (N-i-j) " " j i + " " + j + " " + (N-i-j) i " " j " " (N-i-j) N-i-j N i j return; if((N-i-j) < 0){
                    break;
                } (N-i-j) < 0 (N-i-j) N-i-j N i j 0 {
                    break;
                } break; 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) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int Y = scan.nextInt();
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N; j++){
                if((i*10000 + j*5000 + (N-i-j)*1000) == Y && (N-i-j) >= 0){
                    System.out.println(i + " " + j + " " + (N-i-j));
                    return;
                }else if((N-i-j) < 0){
                    break;
                }
            }
        }
        System.out.println(-1 + " " + -1 + " " + -1);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int Y = scan.nextInt();
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N; j++){
                if((i*10000 + j*5000 + (N-i-j)*1000) == Y && (N-i-j) >= 0){
                    System.out.println(i + " " + j + " " + (N-i-j));
                    return;
                }else if((N-i-j) < 0){
                    break;
                }
            }
        }
        System.out.println(-1 + " " + -1 + " " + -1);
    }
} Main
// "static void main" must be defined in a public class.
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int Y = scan.nextInt();
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N; j++){
                if((i*10000 + j*5000 + (N-i-j)*1000) == Y && (N-i-j) >= 0){
                    System.out.println(i + " " + j + " " + (N-i-j));
                    return;
                }else if((N-i-j) < 0){
                    break;
                }
            }
        }
        System.out.println(-1 + " " + -1 + " " + -1);
    }
}