import java.util.*;
import java.util.stream.*;
class Main {
    public static void main(String[] args) {
        Scanner input;
        input = new Scanner(System.in);
        int N = input.nextInt();
        int Y = input.nextInt();
        int a = -1;
        int b = -1;
        int c = -1;
        boolean flag = false;
        for (int i = 0; i < N+1; i++){
            if (flag){
                break;
            }
            for (int j = 0; j < N+1-i; j++){
                if (i*10000 + j*5000 + (N-i-j)*1000 == Y && (N-i-j) >= 0){
                    a = i;
                    b = j;
                    c = N-i-j;
                    flag = true;
                    break;
                }
            }
        }
        System.out.printf("%d %d %d %n",a,b,c);

    }
} import java.util.*; util.* java import java.util.stream.*; stream.* java.util class Main {
    public static void main(String[] args) {
        Scanner input;
        input = new Scanner(System.in);
        int N = input.nextInt();
        int Y = input.nextInt();
        int a = -1;
        int b = -1;
        int c = -1;
        boolean flag = false;
        for (int i = 0; i < N+1; i++){
            if (flag){
                break;
            }
            for (int j = 0; j < N+1-i; j++){
                if (i*10000 + j*5000 + (N-i-j)*1000 == Y && (N-i-j) >= 0){
                    a = i;
                    b = j;
                    c = N-i-j;
                    flag = true;
                    break;
                }
            }
        }
        System.out.printf("%d %d %d %n",a,b,c);

    }
} Main public static void main(String[] args) {
        Scanner input;
        input = new Scanner(System.in);
        int N = input.nextInt();
        int Y = input.nextInt();
        int a = -1;
        int b = -1;
        int c = -1;
        boolean flag = false;
        for (int i = 0; i < N+1; i++){
            if (flag){
                break;
            }
            for (int j = 0; j < N+1-i; j++){
                if (i*10000 + j*5000 + (N-i-j)*1000 == Y && (N-i-j) >= 0){
                    a = i;
                    b = j;
                    c = N-i-j;
                    flag = true;
                    break;
                }
            }
        }
        System.out.printf("%d %d %d %n",a,b,c);

    } main {
        Scanner input;
        input = new Scanner(System.in);
        int N = input.nextInt();
        int Y = input.nextInt();
        int a = -1;
        int b = -1;
        int c = -1;
        boolean flag = false;
        for (int i = 0; i < N+1; i++){
            if (flag){
                break;
            }
            for (int j = 0; j < N+1-i; j++){
                if (i*10000 + j*5000 + (N-i-j)*1000 == Y && (N-i-j) >= 0){
                    a = i;
                    b = j;
                    c = N-i-j;
                    flag = true;
                    break;
                }
            }
        }
        System.out.printf("%d %d %d %n",a,b,c);

    } Scanner input; input input = new Scanner(System.in) input new Scanner(System.in) int N = input.nextInt(); N input.nextInt() input.nextInt input int Y = input.nextInt(); Y input.nextInt() input.nextInt input int a = -1; a -1 1 int b = -1; b -1 1 int c = -1; c -1 1 boolean flag = false; flag false for (int i = 0; i < N+1; i++){
            if (flag){
                break;
            }
            for (int j = 0; j < N+1-i; j++){
                if (i*10000 + j*5000 + (N-i-j)*1000 == Y && (N-i-j) >= 0){
                    a = i;
                    b = j;
                    c = N-i-j;
                    flag = true;
                    break;
                }
            }
        } int i = 0; int i = 0; i 0 i < N+1 i N+1 N 1 i++ i++ i {
            if (flag){
                break;
            }
            for (int j = 0; j < N+1-i; j++){
                if (i*10000 + j*5000 + (N-i-j)*1000 == Y && (N-i-j) >= 0){
                    a = i;
                    b = j;
                    c = N-i-j;
                    flag = true;
                    break;
                }
            }
        } {
            if (flag){
                break;
            }
            for (int j = 0; j < N+1-i; j++){
                if (i*10000 + j*5000 + (N-i-j)*1000 == Y && (N-i-j) >= 0){
                    a = i;
                    b = j;
                    c = N-i-j;
                    flag = true;
                    break;
                }
            }
        } if (flag){
                break;
            } flag {
                break;
            } break; for (int j = 0; j < N+1-i; j++){
                if (i*10000 + j*5000 + (N-i-j)*1000 == Y && (N-i-j) >= 0){
                    a = i;
                    b = j;
                    c = N-i-j;
                    flag = true;
                    break;
                }
            } int j = 0; int j = 0; j 0 j < N+1-i j N+1-i N+1 N 1 i j++ j++ j {
                if (i*10000 + j*5000 + (N-i-j)*1000 == Y && (N-i-j) >= 0){
                    a = i;
                    b = j;
                    c = N-i-j;
                    flag = true;
                    break;
                }
            } {
                if (i*10000 + j*5000 + (N-i-j)*1000 == Y && (N-i-j) >= 0){
                    a = i;
                    b = j;
                    c = N-i-j;
                    flag = true;
                    break;
                }
            } if (i*10000 + j*5000 + (N-i-j)*1000 == Y && (N-i-j) >= 0){
                    a = i;
                    b = j;
                    c = N-i-j;
                    flag = true;
                    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 {
                    a = i;
                    b = j;
                    c = N-i-j;
                    flag = true;
                    break;
                } a = i a i b = j b j c = N-i-j c N-i-j N-i-j N i j flag = true flag true break; System.out.printf("%d %d %d %n",a,b,c) System.out.printf System.out System System.out "%d %d %d %n" a b c String[] args args
import java.util.*;
import java.util.stream.*;
class Main {
    public static void main(String[] args) {
        Scanner input;
        input = new Scanner(System.in);
        int N = input.nextInt();
        int Y = input.nextInt();
        int a = -1;
        int b = -1;
        int c = -1;
        boolean flag = false;
        for (int i = 0; i < N+1; i++){
            if (flag){
                break;
            }
            for (int j = 0; j < N+1-i; j++){
                if (i*10000 + j*5000 + (N-i-j)*1000 == Y && (N-i-j) >= 0){
                    a = i;
                    b = j;
                    c = N-i-j;
                    flag = true;
                    break;
                }
            }
        }
        System.out.printf("%d %d %d %n",a,b,c);

    }
}