import java.util.Scanner;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int y = s.nextInt();
        boolean f = false;
        int i = 0;
        int j = 0;
        int k = 0;
        for (i = 0; i <= n; i++) {
            for (j = 0; j <= (n - i); j++) {
                k = n - i - j;
                if (y == 10000 * i + 5000 * j + 1000 * k) {
                    if (n == i + j + k ) {
                        f = true;
                        break;
                    }
                }
            }
            if (f) {
                break;
            }
        }
        if (f) {
            System.out.println(i + " " + j + " " + k);
        } else {
            System.out.println("-1 -1 -1");
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]) throws Exception {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int y = s.nextInt();
        boolean f = false;
        int i = 0;
        int j = 0;
        int k = 0;
        for (i = 0; i <= n; i++) {
            for (j = 0; j <= (n - i); j++) {
                k = n - i - j;
                if (y == 10000 * i + 5000 * j + 1000 * k) {
                    if (n == i + j + k ) {
                        f = true;
                        break;
                    }
                }
            }
            if (f) {
                break;
            }
        }
        if (f) {
            System.out.println(i + " " + j + " " + k);
        } else {
            System.out.println("-1 -1 -1");
        }
    }
} Main public static void main(String args[]) throws Exception {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int y = s.nextInt();
        boolean f = false;
        int i = 0;
        int j = 0;
        int k = 0;
        for (i = 0; i <= n; i++) {
            for (j = 0; j <= (n - i); j++) {
                k = n - i - j;
                if (y == 10000 * i + 5000 * j + 1000 * k) {
                    if (n == i + j + k ) {
                        f = true;
                        break;
                    }
                }
            }
            if (f) {
                break;
            }
        }
        if (f) {
            System.out.println(i + " " + j + " " + k);
        } else {
            System.out.println("-1 -1 -1");
        }
    } main {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int y = s.nextInt();
        boolean f = false;
        int i = 0;
        int j = 0;
        int k = 0;
        for (i = 0; i <= n; i++) {
            for (j = 0; j <= (n - i); j++) {
                k = n - i - j;
                if (y == 10000 * i + 5000 * j + 1000 * k) {
                    if (n == i + j + k ) {
                        f = true;
                        break;
                    }
                }
            }
            if (f) {
                break;
            }
        }
        if (f) {
            System.out.println(i + " " + j + " " + k);
        } else {
            System.out.println("-1 -1 -1");
        }
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) int n = s.nextInt(); n s.nextInt() s.nextInt s int y = s.nextInt(); y s.nextInt() s.nextInt s boolean f = false; f false int i = 0; i 0 int j = 0; j 0 int k = 0; k 0 for (i = 0; i <= n; i++) {
            for (j = 0; j <= (n - i); j++) {
                k = n - i - j;
                if (y == 10000 * i + 5000 * j + 1000 * k) {
                    if (n == i + j + k ) {
                        f = true;
                        break;
                    }
                }
            }
            if (f) {
                break;
            }
        } i = 0; i = 0 i 0 i <= n i n i++ i++ i {
            for (j = 0; j <= (n - i); j++) {
                k = n - i - j;
                if (y == 10000 * i + 5000 * j + 1000 * k) {
                    if (n == i + j + k ) {
                        f = true;
                        break;
                    }
                }
            }
            if (f) {
                break;
            }
        } {
            for (j = 0; j <= (n - i); j++) {
                k = n - i - j;
                if (y == 10000 * i + 5000 * j + 1000 * k) {
                    if (n == i + j + k ) {
                        f = true;
                        break;
                    }
                }
            }
            if (f) {
                break;
            }
        } for (j = 0; j <= (n - i); j++) {
                k = n - i - j;
                if (y == 10000 * i + 5000 * j + 1000 * k) {
                    if (n == i + j + k ) {
                        f = true;
                        break;
                    }
                }
            } j = 0; j = 0 j 0 j <= (n - i) j (n - i) n i j++ j++ j {
                k = n - i - j;
                if (y == 10000 * i + 5000 * j + 1000 * k) {
                    if (n == i + j + k ) {
                        f = true;
                        break;
                    }
                }
            } {
                k = n - i - j;
                if (y == 10000 * i + 5000 * j + 1000 * k) {
                    if (n == i + j + k ) {
                        f = true;
                        break;
                    }
                }
            } k = n - i - j k n - i - j n - i - j n i j if (y == 10000 * i + 5000 * j + 1000 * k) {
                    if (n == i + j + k ) {
                        f = true;
                        break;
                    }
                } y == 10000 * i + 5000 * j + 1000 * k y 10000 * i + 5000 * j + 1000 * k 10000 * i + 5000 * j + 1000 * k 10000 * i 10000 i 5000 * j 5000 j 1000 * k 1000 k {
                    if (n == i + j + k ) {
                        f = true;
                        break;
                    }
                } if (n == i + j + k ) {
                        f = true;
                        break;
                    } n == i + j + k n i + j + k i + j + k i j k {
                        f = true;
                        break;
                    } f = true f true break; if (f) {
                break;
            } f {
                break;
            } break; if (f) {
            System.out.println(i + " " + j + " " + k);
        } else {
            System.out.println("-1 -1 -1");
        } f {
            System.out.println(i + " " + j + " " + k);
        } System.out.println(i + " " + j + " " + k) System.out.println System.out System System.out i + " " + j + " " + k " " j i + " " + j + " " + k i " " j " " k {
            System.out.println("-1 -1 -1");
        } 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[]) throws Exception {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int y = s.nextInt();
        boolean f = false;
        int i = 0;
        int j = 0;
        int k = 0;
        for (i = 0; i <= n; i++) {
            for (j = 0; j <= (n - i); j++) {
                k = n - i - j;
                if (y == 10000 * i + 5000 * j + 1000 * k) {
                    if (n == i + j + k ) {
                        f = true;
                        break;
                    }
                }
            }
            if (f) {
                break;
            }
        }
        if (f) {
            System.out.println(i + " " + j + " " + k);
        } else {
            System.out.println("-1 -1 -1");
        }
    }
} public class Main {
    public static void main(String args[]) throws Exception {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int y = s.nextInt();
        boolean f = false;
        int i = 0;
        int j = 0;
        int k = 0;
        for (i = 0; i <= n; i++) {
            for (j = 0; j <= (n - i); j++) {
                k = n - i - j;
                if (y == 10000 * i + 5000 * j + 1000 * k) {
                    if (n == i + j + k ) {
                        f = true;
                        break;
                    }
                }
            }
            if (f) {
                break;
            }
        }
        if (f) {
            System.out.println(i + " " + j + " " + k);
        } else {
            System.out.println("-1 -1 -1");
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int y = s.nextInt();
        boolean f = false;
        int i = 0;
        int j = 0;
        int k = 0;
        for (i = 0; i <= n; i++) {
            for (j = 0; j <= (n - i); j++) {
                k = n - i - j;
                if (y == 10000 * i + 5000 * j + 1000 * k) {
                    if (n == i + j + k ) {
                        f = true;
                        break;
                    }
                }
            }
            if (f) {
                break;
            }
        }
        if (f) {
            System.out.println(i + " " + j + " " + k);
        } else {
            System.out.println("-1 -1 -1");
        }
    }
}