import java.util.Scanner;

class Main {
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int Y = scan.nextInt();
        boolean isFound = false;
        x: for (int i = 0; i <= N; i++) {
            y: for (int j = 0; j <= N - i; j++) {
                int k = N - i - j;
               int total = 10000*i + 5000*j + 1000*k;
               if (total == Y) {
                   System.out.println(i +" "+ j +" "+k);
                   isFound = true;
                   break x;
               }
            }
        }
        if (!isFound) {
            System.out.println(-1 +" "+ -1 +" "+-1);
        }
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int Y = scan.nextInt();
        boolean isFound = false;
        x: for (int i = 0; i <= N; i++) {
            y: for (int j = 0; j <= N - i; j++) {
                int k = N - i - j;
               int total = 10000*i + 5000*j + 1000*k;
               if (total == Y) {
                   System.out.println(i +" "+ j +" "+k);
                   isFound = true;
                   break x;
               }
            }
        }
        if (!isFound) {
            System.out.println(-1 +" "+ -1 +" "+-1);
        }
    }
} Main public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int Y = scan.nextInt();
        boolean isFound = false;
        x: for (int i = 0; i <= N; i++) {
            y: for (int j = 0; j <= N - i; j++) {
                int k = N - i - j;
               int total = 10000*i + 5000*j + 1000*k;
               if (total == Y) {
                   System.out.println(i +" "+ j +" "+k);
                   isFound = true;
                   break x;
               }
            }
        }
        if (!isFound) {
            System.out.println(-1 +" "+ -1 +" "+-1);
        }
    } main {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int Y = scan.nextInt();
        boolean isFound = false;
        x: for (int i = 0; i <= N; i++) {
            y: for (int j = 0; j <= N - i; j++) {
                int k = N - i - j;
               int total = 10000*i + 5000*j + 1000*k;
               if (total == Y) {
                   System.out.println(i +" "+ j +" "+k);
                   isFound = true;
                   break x;
               }
            }
        }
        if (!isFound) {
            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 boolean isFound = false; isFound false if (!isFound) {
            System.out.println(-1 +" "+ -1 +" "+-1);
        } !isFound isFound {
            System.out.println(-1 +" "+ -1 +" "+-1);
        } 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 final String[] args args
import java.util.Scanner;

class Main {
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int Y = scan.nextInt();
        boolean isFound = false;
        x: for (int i = 0; i <= N; i++) {
            y: for (int j = 0; j <= N - i; j++) {
                int k = N - i - j;
               int total = 10000*i + 5000*j + 1000*k;
               if (total == Y) {
                   System.out.println(i +" "+ j +" "+k);
                   isFound = true;
                   break x;
               }
            }
        }
        if (!isFound) {
            System.out.println(-1 +" "+ -1 +" "+-1);
        }
    }
}