import java.util.Scanner;

public class Main{

    static void isOK(int a, int b, int c, int N, int Y) {
        if(a+b+c == N && (a*10000)+(b*5000)+(c*1000) == Y) {
            System.out.println(a + " " + b + " " + c);
            System.exit(0);
        }
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int N = scan.nextInt();
        int Y = scan.nextInt();
        int a = 0,b = 0,c;

        c = Y/1000;
        int tmp_c = c;
        isOK(a, b, c, N, Y);
        for(int i = 0; i < tmp_c/5; i++) {
            c -= 5;
            b++;
            if (a + b + c < N) {
                c += 5;
                b--;
                break;
            }
            isOK(a, b, c, N, Y);
        }

        int tmp_b = b;
        for(int i = 0; i < tmp_b/2; i++) {
            b -= 2;
            a++;
            isOK(a, b, c, N, Y);
        }

        System.out.println("-1 -1 -1");

    }
} import java.util.Scanner; Scanner java.util public class Main{

    static void isOK(int a, int b, int c, int N, int Y) {
        if(a+b+c == N && (a*10000)+(b*5000)+(c*1000) == Y) {
            System.out.println(a + " " + b + " " + c);
            System.exit(0);
        }
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int N = scan.nextInt();
        int Y = scan.nextInt();
        int a = 0,b = 0,c;

        c = Y/1000;
        int tmp_c = c;
        isOK(a, b, c, N, Y);
        for(int i = 0; i < tmp_c/5; i++) {
            c -= 5;
            b++;
            if (a + b + c < N) {
                c += 5;
                b--;
                break;
            }
            isOK(a, b, c, N, Y);
        }

        int tmp_b = b;
        for(int i = 0; i < tmp_b/2; i++) {
            b -= 2;
            a++;
            isOK(a, b, c, N, Y);
        }

        System.out.println("-1 -1 -1");

    }
} Main static void isOK(int a, int b, int c, int N, int Y) {
        if(a+b+c == N && (a*10000)+(b*5000)+(c*1000) == Y) {
            System.out.println(a + " " + b + " " + c);
            System.exit(0);
        }
    } isOK {
        if(a+b+c == N && (a*10000)+(b*5000)+(c*1000) == Y) {
            System.out.println(a + " " + b + " " + c);
            System.exit(0);
        }
    } if(a+b+c == N && (a*10000)+(b*5000)+(c*1000) == Y) {
            System.out.println(a + " " + b + " " + c);
            System.exit(0);
        } a+b+c == N && (a*10000)+(b*5000)+(c*1000) == Y a+b+c == N a+b+c a+b+c a b c N (a*10000)+(b*5000)+(c*1000) == Y (a*10000)+(b*5000)+(c*1000) (a*10000)+(b*5000)+(c*1000) (a*10000) a 10000 (b*5000) b 5000 (c*1000) c 1000 Y {
            System.out.println(a + " " + b + " " + c);
            System.exit(0);
        } System.out.println(a + " " + b + " " + c) System.out.println System.out System System.out a + " " + b + " " + c " " b a + " " + b + " " + c a " " b " " c System.exit(0) System.exit System 0 int a a int b b int c c int N N int Y Y public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int N = scan.nextInt();
        int Y = scan.nextInt();
        int a = 0,b = 0,c;

        c = Y/1000;
        int tmp_c = c;
        isOK(a, b, c, N, Y);
        for(int i = 0; i < tmp_c/5; i++) {
            c -= 5;
            b++;
            if (a + b + c < N) {
                c += 5;
                b--;
                break;
            }
            isOK(a, b, c, N, Y);
        }

        int tmp_b = b;
        for(int i = 0; i < tmp_b/2; i++) {
            b -= 2;
            a++;
            isOK(a, b, c, N, Y);
        }

        System.out.println("-1 -1 -1");

    } main {
        Scanner scan = new Scanner(System.in);

        int N = scan.nextInt();
        int Y = scan.nextInt();
        int a = 0,b = 0,c;

        c = Y/1000;
        int tmp_c = c;
        isOK(a, b, c, N, Y);
        for(int i = 0; i < tmp_c/5; i++) {
            c -= 5;
            b++;
            if (a + b + c < N) {
                c += 5;
                b--;
                break;
            }
            isOK(a, b, c, N, Y);
        }

        int tmp_b = b;
        for(int i = 0; i < tmp_b/2; i++) {
            b -= 2;
            a++;
            isOK(a, b, c, N, Y);
        }

        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 int a = 0 a 0 b = 0 b 0 c; c c = Y/1000 c Y/1000 Y 1000 int tmp_c = c; tmp_c c isOK(a, b, c, N, Y) isOK a b c N Y for(int i = 0; i < tmp_c/5; i++) {
            c -= 5;
            b++;
            if (a + b + c < N) {
                c += 5;
                b--;
                break;
            }
            isOK(a, b, c, N, Y);
        } int i = 0; int i = 0; i 0 i < tmp_c/5 i tmp_c/5 tmp_c 5 i++ i++ i {
            c -= 5;
            b++;
            if (a + b + c < N) {
                c += 5;
                b--;
                break;
            }
            isOK(a, b, c, N, Y);
        } {
            c -= 5;
            b++;
            if (a + b + c < N) {
                c += 5;
                b--;
                break;
            }
            isOK(a, b, c, N, Y);
        } c -= 5 c 5 b++ b if (a + b + c < N) {
                c += 5;
                b--;
                break;
            } a + b + c < N a + b + c a + b + c a b c N {
                c += 5;
                b--;
                break;
            } c += 5 c 5 b-- b break; isOK(a, b, c, N, Y) isOK a b c N Y int tmp_b = b; tmp_b b for(int i = 0; i < tmp_b/2; i++) {
            b -= 2;
            a++;
            isOK(a, b, c, N, Y);
        } int i = 0; int i = 0; i 0 i < tmp_b/2 i tmp_b/2 tmp_b 2 i++ i++ i {
            b -= 2;
            a++;
            isOK(a, b, c, N, Y);
        } {
            b -= 2;
            a++;
            isOK(a, b, c, N, Y);
        } b -= 2 b 2 a++ a isOK(a, b, c, N, Y) isOK a b c N Y System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[] args args public class Main{

    static void isOK(int a, int b, int c, int N, int Y) {
        if(a+b+c == N && (a*10000)+(b*5000)+(c*1000) == Y) {
            System.out.println(a + " " + b + " " + c);
            System.exit(0);
        }
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int N = scan.nextInt();
        int Y = scan.nextInt();
        int a = 0,b = 0,c;

        c = Y/1000;
        int tmp_c = c;
        isOK(a, b, c, N, Y);
        for(int i = 0; i < tmp_c/5; i++) {
            c -= 5;
            b++;
            if (a + b + c < N) {
                c += 5;
                b--;
                break;
            }
            isOK(a, b, c, N, Y);
        }

        int tmp_b = b;
        for(int i = 0; i < tmp_b/2; i++) {
            b -= 2;
            a++;
            isOK(a, b, c, N, Y);
        }

        System.out.println("-1 -1 -1");

    }
} public class Main{

    static void isOK(int a, int b, int c, int N, int Y) {
        if(a+b+c == N && (a*10000)+(b*5000)+(c*1000) == Y) {
            System.out.println(a + " " + b + " " + c);
            System.exit(0);
        }
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int N = scan.nextInt();
        int Y = scan.nextInt();
        int a = 0,b = 0,c;

        c = Y/1000;
        int tmp_c = c;
        isOK(a, b, c, N, Y);
        for(int i = 0; i < tmp_c/5; i++) {
            c -= 5;
            b++;
            if (a + b + c < N) {
                c += 5;
                b--;
                break;
            }
            isOK(a, b, c, N, Y);
        }

        int tmp_b = b;
        for(int i = 0; i < tmp_b/2; i++) {
            b -= 2;
            a++;
            isOK(a, b, c, N, Y);
        }

        System.out.println("-1 -1 -1");

    }
} Main
import java.util.Scanner;

public class Main{

    static void isOK(int a, int b, int c, int N, int Y) {
        if(a+b+c == N && (a*10000)+(b*5000)+(c*1000) == Y) {
            System.out.println(a + " " + b + " " + c);
            System.exit(0);
        }
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int N = scan.nextInt();
        int Y = scan.nextInt();
        int a = 0,b = 0,c;

        c = Y/1000;
        int tmp_c = c;
        isOK(a, b, c, N, Y);
        for(int i = 0; i < tmp_c/5; i++) {
            c -= 5;
            b++;
            if (a + b + c < N) {
                c += 5;
                b--;
                break;
            }
            isOK(a, b, c, N, Y);
        }

        int tmp_b = b;
        for(int i = 0; i < tmp_b/2; i++) {
            b -= 2;
            a++;
            isOK(a, b, c, N, Y);
        }

        System.out.println("-1 -1 -1");

    }
}