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

        int a = 0;
        int b = 0;
        int c = 0;

        boolean isOk = false;
        for (int i = 0; i < n + 1; i++) {
            a = i;
            for (int j = 0; j < n - i + 1; j++) {
                b = j;
                c = n - a - b;
                if (10000*a + 5000*b + 1000*c == y) {
                    isOk = true;
                    break;
                }
            }
            if (isOk) break;
        }
        if (!isOk) {
            a = -1;
            b = -1;
            c = -1;
        }

        System.out.print(a);
        System.out.print(" ");
        System.out.print(b);
        System.out.print(" ");
        System.out.println(c);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        int a = 0;
        int b = 0;
        int c = 0;

        boolean isOk = false;
        for (int i = 0; i < n + 1; i++) {
            a = i;
            for (int j = 0; j < n - i + 1; j++) {
                b = j;
                c = n - a - b;
                if (10000*a + 5000*b + 1000*c == y) {
                    isOk = true;
                    break;
                }
            }
            if (isOk) break;
        }
        if (!isOk) {
            a = -1;
            b = -1;
            c = -1;
        }

        System.out.print(a);
        System.out.print(" ");
        System.out.print(b);
        System.out.print(" ");
        System.out.println(c);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        int a = 0;
        int b = 0;
        int c = 0;

        boolean isOk = false;
        for (int i = 0; i < n + 1; i++) {
            a = i;
            for (int j = 0; j < n - i + 1; j++) {
                b = j;
                c = n - a - b;
                if (10000*a + 5000*b + 1000*c == y) {
                    isOk = true;
                    break;
                }
            }
            if (isOk) break;
        }
        if (!isOk) {
            a = -1;
            b = -1;
            c = -1;
        }

        System.out.print(a);
        System.out.print(" ");
        System.out.print(b);
        System.out.print(" ");
        System.out.println(c);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        int a = 0;
        int b = 0;
        int c = 0;

        boolean isOk = false;
        for (int i = 0; i < n + 1; i++) {
            a = i;
            for (int j = 0; j < n - i + 1; j++) {
                b = j;
                c = n - a - b;
                if (10000*a + 5000*b + 1000*c == y) {
                    isOk = true;
                    break;
                }
            }
            if (isOk) break;
        }
        if (!isOk) {
            a = -1;
            b = -1;
            c = -1;
        }

        System.out.print(a);
        System.out.print(" ");
        System.out.print(b);
        System.out.print(" ");
        System.out.println(c);
    } 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 int a = 0; a 0 int b = 0; b 0 int c = 0; c 0 boolean isOk = false; isOk false for (int i = 0; i < n + 1; i++) {
            a = i;
            for (int j = 0; j < n - i + 1; j++) {
                b = j;
                c = n - a - b;
                if (10000*a + 5000*b + 1000*c == y) {
                    isOk = true;
                    break;
                }
            }
            if (isOk) break;
        } int i = 0; int i = 0; i 0 i < n + 1 i n + 1 n 1 i++ i++ i {
            a = i;
            for (int j = 0; j < n - i + 1; j++) {
                b = j;
                c = n - a - b;
                if (10000*a + 5000*b + 1000*c == y) {
                    isOk = true;
                    break;
                }
            }
            if (isOk) break;
        } {
            a = i;
            for (int j = 0; j < n - i + 1; j++) {
                b = j;
                c = n - a - b;
                if (10000*a + 5000*b + 1000*c == y) {
                    isOk = true;
                    break;
                }
            }
            if (isOk) break;
        } a = i a i for (int j = 0; j < n - i + 1; j++) {
                b = j;
                c = n - a - b;
                if (10000*a + 5000*b + 1000*c == y) {
                    isOk = true;
                    break;
                }
            } int j = 0; int j = 0; j 0 j < n - i + 1 j n - i + 1 n - i n i 1 j++ j++ j {
                b = j;
                c = n - a - b;
                if (10000*a + 5000*b + 1000*c == y) {
                    isOk = true;
                    break;
                }
            } {
                b = j;
                c = n - a - b;
                if (10000*a + 5000*b + 1000*c == y) {
                    isOk = true;
                    break;
                }
            } b = j b j c = n - a - b c n - a - b n - a - b n a b if (10000*a + 5000*b + 1000*c == y) {
                    isOk = true;
                    break;
                } 10000*a + 5000*b + 1000*c == y 10000*a + 5000*b + 1000*c 10000*a + 5000*b + 1000*c 10000*a 10000 a 5000*b 5000 b 1000*c 1000 c y {
                    isOk = true;
                    break;
                } isOk = true isOk true break; if (isOk) break; isOk break; if (!isOk) {
            a = -1;
            b = -1;
            c = -1;
        } !isOk isOk {
            a = -1;
            b = -1;
            c = -1;
        } a = -1 a -1 1 b = -1 b -1 1 c = -1 c -1 1 System.out.print(a) System.out.print System.out System System.out a System.out.print(" ") System.out.print System.out System System.out " " System.out.print(b) System.out.print System.out System System.out b System.out.print(" ") System.out.print System.out System System.out " " System.out.println(c) System.out.println System.out System System.out c 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();

        int a = 0;
        int b = 0;
        int c = 0;

        boolean isOk = false;
        for (int i = 0; i < n + 1; i++) {
            a = i;
            for (int j = 0; j < n - i + 1; j++) {
                b = j;
                c = n - a - b;
                if (10000*a + 5000*b + 1000*c == y) {
                    isOk = true;
                    break;
                }
            }
            if (isOk) break;
        }
        if (!isOk) {
            a = -1;
            b = -1;
            c = -1;
        }

        System.out.print(a);
        System.out.print(" ");
        System.out.print(b);
        System.out.print(" ");
        System.out.println(c);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        int a = 0;
        int b = 0;
        int c = 0;

        boolean isOk = false;
        for (int i = 0; i < n + 1; i++) {
            a = i;
            for (int j = 0; j < n - i + 1; j++) {
                b = j;
                c = n - a - b;
                if (10000*a + 5000*b + 1000*c == y) {
                    isOk = true;
                    break;
                }
            }
            if (isOk) break;
        }
        if (!isOk) {
            a = -1;
            b = -1;
            c = -1;
        }

        System.out.print(a);
        System.out.print(" ");
        System.out.print(b);
        System.out.print(" ");
        System.out.println(c);
    }
} Main
import 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();

        int a = 0;
        int b = 0;
        int c = 0;

        boolean isOk = false;
        for (int i = 0; i < n + 1; i++) {
            a = i;
            for (int j = 0; j < n - i + 1; j++) {
                b = j;
                c = n - a - b;
                if (10000*a + 5000*b + 1000*c == y) {
                    isOk = true;
                    break;
                }
            }
            if (isOk) break;
        }
        if (!isOk) {
            a = -1;
            b = -1;
            c = -1;
        }

        System.out.print(a);
        System.out.print(" ");
        System.out.print(b);
        System.out.print(" ");
        System.out.println(c);
    }
}
