import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt() / 1000;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; i + j <= n; j++) {
                int k = n - i - j;
                int sum = i * 10 + j * 5 + k;
                if (sum == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return ;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }

} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt() / 1000;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; i + j <= n; j++) {
                int k = n - i - j;
                int sum = i * 10 + j * 5 + k;
                if (sum == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return ;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt() / 1000;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; i + j <= n; j++) {
                int k = n - i - j;
                int sum = i * 10 + j * 5 + k;
                if (sum == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return ;
                }
            }
        }
        System.out.println("-1 -1 -1");
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt() / 1000;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; i + j <= n; j++) {
                int k = n - i - j;
                int sum = i * 10 + j * 5 + k;
                if (sum == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return ;
                }
            }
        }
        System.out.println("-1 -1 -1");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int y = sc.nextInt() / 1000; y sc.nextInt() / 1000 sc.nextInt() sc.nextInt sc 1000 for (int i = 0; i <= n; i++) {
            for (int j = 0; i + j <= n; j++) {
                int k = n - i - j;
                int sum = i * 10 + j * 5 + k;
                if (sum == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return ;
                }
            }
        } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
            for (int j = 0; i + j <= n; j++) {
                int k = n - i - j;
                int sum = i * 10 + j * 5 + k;
                if (sum == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return ;
                }
            }
        } {
            for (int j = 0; i + j <= n; j++) {
                int k = n - i - j;
                int sum = i * 10 + j * 5 + k;
                if (sum == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return ;
                }
            }
        } for (int j = 0; i + j <= n; j++) {
                int k = n - i - j;
                int sum = i * 10 + j * 5 + k;
                if (sum == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return ;
                }
            } int j = 0; int j = 0; j 0 i + j <= n i + j i j n j++ j++ j {
                int k = n - i - j;
                int sum = i * 10 + j * 5 + k;
                if (sum == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return ;
                }
            } {
                int k = n - i - j;
                int sum = i * 10 + j * 5 + k;
                if (sum == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return ;
                }
            } int k = n - i - j; k n - i - j n - i - j n i j int sum = i * 10 + j * 5 + k; sum i * 10 + j * 5 + k i * 10 + j * 5 + k i * 10 i 10 j * 5 j 5 k if (sum == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return ;
                } sum == y sum y {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return ;
                } System.out.println(String.format("%d %d %d", i, j, k)) System.out.println System.out System System.out String.format("%d %d %d", i, j, k) String.format String "%d %d %d" i j k return ; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[] args args public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt() / 1000;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; i + j <= n; j++) {
                int k = n - i - j;
                int sum = i * 10 + j * 5 + k;
                if (sum == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return ;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }

} public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt() / 1000;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; i + j <= n; j++) {
                int k = n - i - j;
                int sum = i * 10 + j * 5 + k;
                if (sum == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return ;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }

} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt() / 1000;
        for (int i = 0; i <= n; i++) {
            for (int j = 0; i + j <= n; j++) {
                int k = n - i - j;
                int sum = i * 10 + j * 5 + k;
                if (sum == y) {
                    System.out.println(String.format("%d %d %d", i, j, k));
                    return ;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }

}