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();

        for (int i0 = 0; i0 <= n && 10000 * i0 <= y; i0++) {
            for (int i1 = 0; i0 + i1 <= n && 10000 * i0 + 5000 * i1 <= y; i1++) {
                for (int i2 = 0; 10000 * i0 + 5000 * i1 + 1000 * i2 <= y && i0 + i1 + i2 <= n; i2++) {
                    if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        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();

        for (int i0 = 0; i0 <= n && 10000 * i0 <= y; i0++) {
            for (int i1 = 0; i0 + i1 <= n && 10000 * i0 + 5000 * i1 <= y; i1++) {
                for (int i2 = 0; 10000 * i0 + 5000 * i1 + 1000 * i2 <= y && i0 + i1 + i2 <= n; i2++) {
                    if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        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();

        for (int i0 = 0; i0 <= n && 10000 * i0 <= y; i0++) {
            for (int i1 = 0; i0 + i1 <= n && 10000 * i0 + 5000 * i1 <= y; i1++) {
                for (int i2 = 0; 10000 * i0 + 5000 * i1 + 1000 * i2 <= y && i0 + i1 + i2 <= n; i2++) {
                    if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        return;
                    }
                }
            }
        }
        System.out.println("-1 -1 -1");
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        for (int i0 = 0; i0 <= n && 10000 * i0 <= y; i0++) {
            for (int i1 = 0; i0 + i1 <= n && 10000 * i0 + 5000 * i1 <= y; i1++) {
                for (int i2 = 0; 10000 * i0 + 5000 * i1 + 1000 * i2 <= y && i0 + i1 + i2 <= n; i2++) {
                    if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        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(); y sc.nextInt() sc.nextInt sc for (int i0 = 0; i0 <= n && 10000 * i0 <= y; i0++) {
            for (int i1 = 0; i0 + i1 <= n && 10000 * i0 + 5000 * i1 <= y; i1++) {
                for (int i2 = 0; 10000 * i0 + 5000 * i1 + 1000 * i2 <= y && i0 + i1 + i2 <= n; i2++) {
                    if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        return;
                    }
                }
            }
        } int i0 = 0; int i0 = 0; i0 0 i0 <= n && 10000 * i0 <= y i0 <= n i0 n 10000 * i0 <= y 10000 * i0 10000 i0 y i0++ i0++ i0 {
            for (int i1 = 0; i0 + i1 <= n && 10000 * i0 + 5000 * i1 <= y; i1++) {
                for (int i2 = 0; 10000 * i0 + 5000 * i1 + 1000 * i2 <= y && i0 + i1 + i2 <= n; i2++) {
                    if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        return;
                    }
                }
            }
        } {
            for (int i1 = 0; i0 + i1 <= n && 10000 * i0 + 5000 * i1 <= y; i1++) {
                for (int i2 = 0; 10000 * i0 + 5000 * i1 + 1000 * i2 <= y && i0 + i1 + i2 <= n; i2++) {
                    if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        return;
                    }
                }
            }
        } for (int i1 = 0; i0 + i1 <= n && 10000 * i0 + 5000 * i1 <= y; i1++) {
                for (int i2 = 0; 10000 * i0 + 5000 * i1 + 1000 * i2 <= y && i0 + i1 + i2 <= n; i2++) {
                    if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        return;
                    }
                }
            } int i1 = 0; int i1 = 0; i1 0 i0 + i1 <= n && 10000 * i0 + 5000 * i1 <= y i0 + i1 <= n i0 + i1 i0 i1 n 10000 * i0 + 5000 * i1 <= y 10000 * i0 + 5000 * i1 10000 * i0 10000 i0 5000 * i1 5000 i1 y i1++ i1++ i1 {
                for (int i2 = 0; 10000 * i0 + 5000 * i1 + 1000 * i2 <= y && i0 + i1 + i2 <= n; i2++) {
                    if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        return;
                    }
                }
            } {
                for (int i2 = 0; 10000 * i0 + 5000 * i1 + 1000 * i2 <= y && i0 + i1 + i2 <= n; i2++) {
                    if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        return;
                    }
                }
            } for (int i2 = 0; 10000 * i0 + 5000 * i1 + 1000 * i2 <= y && i0 + i1 + i2 <= n; i2++) {
                    if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        return;
                    }
                } int i2 = 0; int i2 = 0; i2 0 10000 * i0 + 5000 * i1 + 1000 * i2 <= y && i0 + i1 + i2 <= n 10000 * i0 + 5000 * i1 + 1000 * i2 <= y 10000 * i0 + 5000 * i1 + 1000 * i2 10000 * i0 + 5000 * i1 + 1000 * i2 10000 * i0 10000 i0 5000 * i1 5000 i1 1000 * i2 1000 i2 y i0 + i1 + i2 <= n i0 + i1 + i2 i0 + i1 + i2 i0 i1 i2 n i2++ i2++ i2 {
                    if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        return;
                    }
                } {
                    if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        return;
                    }
                } if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        return;
                    } 10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n 10000 * i0 + 5000 * i1 + 1000 * i2 == y 10000 * i0 + 5000 * i1 + 1000 * i2 10000 * i0 + 5000 * i1 + 1000 * i2 10000 * i0 10000 i0 5000 * i1 5000 i1 1000 * i2 1000 i2 y i0 + i1 + i2 == n i0 + i1 + i2 i0 + i1 + i2 i0 i1 i2 n {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        return;
                    } System.out.println(String.format("%d %d %d", i0, i1, i2)) System.out.println System.out System System.out String.format("%d %d %d", i0, i1, i2) String.format String "%d %d %d" i0 i1 i2 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();

        for (int i0 = 0; i0 <= n && 10000 * i0 <= y; i0++) {
            for (int i1 = 0; i0 + i1 <= n && 10000 * i0 + 5000 * i1 <= y; i1++) {
                for (int i2 = 0; 10000 * i0 + 5000 * i1 + 1000 * i2 <= y && i0 + i1 + i2 <= n; i2++) {
                    if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        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();

        for (int i0 = 0; i0 <= n && 10000 * i0 <= y; i0++) {
            for (int i1 = 0; i0 + i1 <= n && 10000 * i0 + 5000 * i1 <= y; i1++) {
                for (int i2 = 0; 10000 * i0 + 5000 * i1 + 1000 * i2 <= y && i0 + i1 + i2 <= n; i2++) {
                    if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        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();

        for (int i0 = 0; i0 <= n && 10000 * i0 <= y; i0++) {
            for (int i1 = 0; i0 + i1 <= n && 10000 * i0 + 5000 * i1 <= y; i1++) {
                for (int i2 = 0; 10000 * i0 + 5000 * i1 + 1000 * i2 <= y && i0 + i1 + i2 <= n; i2++) {
                    if (10000 * i0 + 5000 * i1 + 1000 * i2 == y && i0 + i1 + i2 == n) {
                        System.out.println(String.format("%d %d %d", i0, i1, i2));
                        return;
                    }
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
}
