import java.util.*;
import java.util.stream.Collectors;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        int n = sc.nextInt();
        int otoshidama = sc.nextInt();

        int x = -1;
        int y = -1;
        int z = -1;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j + i <= n; j++) {
                int k = n - i - j;
                if (i * 10000 + j * 5000 + k * 1000 == otoshidama) {
                    x = i;
                    y = j;
                    z = k;
                    break;
                }
            }
        }
        System.out.println(x + " " + y + " " + z);
    }
} import java.util.*; util.* java import java.util.stream.Collectors; Collectors java.util.stream class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        int n = sc.nextInt();
        int otoshidama = sc.nextInt();

        int x = -1;
        int y = -1;
        int z = -1;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j + i <= n; j++) {
                int k = n - i - j;
                if (i * 10000 + j * 5000 + k * 1000 == otoshidama) {
                    x = i;
                    y = j;
                    z = k;
                    break;
                }
            }
        }
        System.out.println(x + " " + y + " " + z);
    }
} Main public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        int n = sc.nextInt();
        int otoshidama = sc.nextInt();

        int x = -1;
        int y = -1;
        int z = -1;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j + i <= n; j++) {
                int k = n - i - j;
                if (i * 10000 + j * 5000 + k * 1000 == otoshidama) {
                    x = i;
                    y = j;
                    z = k;
                    break;
                }
            }
        }
        System.out.println(x + " " + y + " " + z);
    } main {
        Scanner sc = new Scanner(System.in);
      
        int n = sc.nextInt();
        int otoshidama = sc.nextInt();

        int x = -1;
        int y = -1;
        int z = -1;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j + i <= n; j++) {
                int k = n - i - j;
                if (i * 10000 + j * 5000 + k * 1000 == otoshidama) {
                    x = i;
                    y = j;
                    z = k;
                    break;
                }
            }
        }
        System.out.println(x + " " + y + " " + z);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int otoshidama = sc.nextInt(); otoshidama sc.nextInt() sc.nextInt sc int x = -1; x -1 1 int y = -1; y -1 1 int z = -1; z -1 1 for (int i = 0; i <= n; i++) {
            for (int j = 0; j + i <= n; j++) {
                int k = n - i - j;
                if (i * 10000 + j * 5000 + k * 1000 == otoshidama) {
                    x = i;
                    y = j;
                    z = k;
                    break;
                }
            }
        } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
            for (int j = 0; j + i <= n; j++) {
                int k = n - i - j;
                if (i * 10000 + j * 5000 + k * 1000 == otoshidama) {
                    x = i;
                    y = j;
                    z = k;
                    break;
                }
            }
        } {
            for (int j = 0; j + i <= n; j++) {
                int k = n - i - j;
                if (i * 10000 + j * 5000 + k * 1000 == otoshidama) {
                    x = i;
                    y = j;
                    z = k;
                    break;
                }
            }
        } for (int j = 0; j + i <= n; j++) {
                int k = n - i - j;
                if (i * 10000 + j * 5000 + k * 1000 == otoshidama) {
                    x = i;
                    y = j;
                    z = k;
                    break;
                }
            } int j = 0; int j = 0; j 0 j + i <= n j + i j i n j++ j++ j {
                int k = n - i - j;
                if (i * 10000 + j * 5000 + k * 1000 == otoshidama) {
                    x = i;
                    y = j;
                    z = k;
                    break;
                }
            } {
                int k = n - i - j;
                if (i * 10000 + j * 5000 + k * 1000 == otoshidama) {
                    x = i;
                    y = j;
                    z = k;
                    break;
                }
            } int k = n - i - j; k n - i - j n - i - j n i j if (i * 10000 + j * 5000 + k * 1000 == otoshidama) {
                    x = i;
                    y = j;
                    z = k;
                    break;
                } i * 10000 + j * 5000 + k * 1000 == otoshidama i * 10000 + j * 5000 + k * 1000 i * 10000 + j * 5000 + k * 1000 i * 10000 i 10000 j * 5000 j 5000 k * 1000 k 1000 otoshidama {
                    x = i;
                    y = j;
                    z = k;
                    break;
                } x = i x i y = j y j z = k z k break; System.out.println(x + " " + y + " " + z) System.out.println System.out System System.out x + " " + y + " " + z " " y x + " " + y + " " + z x " " y " " z String args[] args
import java.util.*;
import java.util.stream.Collectors;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        int n = sc.nextInt();
        int otoshidama = sc.nextInt();

        int x = -1;
        int y = -1;
        int z = -1;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j + i <= n; j++) {
                int k = n - i - j;
                if (i * 10000 + j * 5000 + k * 1000 == otoshidama) {
                    x = i;
                    y = j;
                    z = k;
                    break;
                }
            }
        }
        System.out.println(x + " " + y + " " + z);
    }
}