import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long n = s.nextLong(), y = s.nextLong();
        long mx = -1;
        long a10000 = -1, a5000 = -1, a1000 = -1;
        boolean ok = true;
        for(long i = 0; i <= y / 10000 && ok; ++i) {
            for(long j = 0; j <= (y - i * 10000)/ 5000; ++j) {
                long total = i * 10000 + j * 5000;
                long k = (y - total) / 1000;
                if (i * 10000 + j * 5000 + k * 1000 == y && i + j + k == n) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = k;
                    ok = false;
                    break;
                }
            }
        }
        System.out.println(a10000 + " " + a5000 + " " + a1000);
    }
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long n = s.nextLong(), y = s.nextLong();
        long mx = -1;
        long a10000 = -1, a5000 = -1, a1000 = -1;
        boolean ok = true;
        for(long i = 0; i <= y / 10000 && ok; ++i) {
            for(long j = 0; j <= (y - i * 10000)/ 5000; ++j) {
                long total = i * 10000 + j * 5000;
                long k = (y - total) / 1000;
                if (i * 10000 + j * 5000 + k * 1000 == y && i + j + k == n) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = k;
                    ok = false;
                    break;
                }
            }
        }
        System.out.println(a10000 + " " + a5000 + " " + a1000);
    }
} Main public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long n = s.nextLong(), y = s.nextLong();
        long mx = -1;
        long a10000 = -1, a5000 = -1, a1000 = -1;
        boolean ok = true;
        for(long i = 0; i <= y / 10000 && ok; ++i) {
            for(long j = 0; j <= (y - i * 10000)/ 5000; ++j) {
                long total = i * 10000 + j * 5000;
                long k = (y - total) / 1000;
                if (i * 10000 + j * 5000 + k * 1000 == y && i + j + k == n) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = k;
                    ok = false;
                    break;
                }
            }
        }
        System.out.println(a10000 + " " + a5000 + " " + a1000);
    } main {
        Scanner s = new Scanner(System.in);
        long n = s.nextLong(), y = s.nextLong();
        long mx = -1;
        long a10000 = -1, a5000 = -1, a1000 = -1;
        boolean ok = true;
        for(long i = 0; i <= y / 10000 && ok; ++i) {
            for(long j = 0; j <= (y - i * 10000)/ 5000; ++j) {
                long total = i * 10000 + j * 5000;
                long k = (y - total) / 1000;
                if (i * 10000 + j * 5000 + k * 1000 == y && i + j + k == n) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = k;
                    ok = false;
                    break;
                }
            }
        }
        System.out.println(a10000 + " " + a5000 + " " + a1000);
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) long n = s.nextLong() n s.nextLong() s.nextLong s y = s.nextLong(); y s.nextLong() s.nextLong s long mx = -1; mx -1 1 long a10000 = -1 a10000 -1 1 a5000 = -1 a5000 -1 1 a1000 = -1; a1000 -1 1 boolean ok = true; ok true for(long i = 0; i <= y / 10000 && ok; ++i) {
            for(long j = 0; j <= (y - i * 10000)/ 5000; ++j) {
                long total = i * 10000 + j * 5000;
                long k = (y - total) / 1000;
                if (i * 10000 + j * 5000 + k * 1000 == y && i + j + k == n) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = k;
                    ok = false;
                    break;
                }
            }
        } long i = 0; long i = 0; i 0 i <= y / 10000 && ok i <= y / 10000 i y / 10000 y 10000 ok ++i ++i i {
            for(long j = 0; j <= (y - i * 10000)/ 5000; ++j) {
                long total = i * 10000 + j * 5000;
                long k = (y - total) / 1000;
                if (i * 10000 + j * 5000 + k * 1000 == y && i + j + k == n) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = k;
                    ok = false;
                    break;
                }
            }
        } {
            for(long j = 0; j <= (y - i * 10000)/ 5000; ++j) {
                long total = i * 10000 + j * 5000;
                long k = (y - total) / 1000;
                if (i * 10000 + j * 5000 + k * 1000 == y && i + j + k == n) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = k;
                    ok = false;
                    break;
                }
            }
        } for(long j = 0; j <= (y - i * 10000)/ 5000; ++j) {
                long total = i * 10000 + j * 5000;
                long k = (y - total) / 1000;
                if (i * 10000 + j * 5000 + k * 1000 == y && i + j + k == n) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = k;
                    ok = false;
                    break;
                }
            } long j = 0; long j = 0; j 0 j <= (y - i * 10000)/ 5000 j (y - i * 10000)/ 5000 (y - i * 10000) y i * 10000 i 10000 5000 ++j ++j j {
                long total = i * 10000 + j * 5000;
                long k = (y - total) / 1000;
                if (i * 10000 + j * 5000 + k * 1000 == y && i + j + k == n) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = k;
                    ok = false;
                    break;
                }
            } {
                long total = i * 10000 + j * 5000;
                long k = (y - total) / 1000;
                if (i * 10000 + j * 5000 + k * 1000 == y && i + j + k == n) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = k;
                    ok = false;
                    break;
                }
            } long total = i * 10000 + j * 5000; total i * 10000 + j * 5000 i * 10000 i 10000 j * 5000 j 5000 long k = (y - total) / 1000; k (y - total) / 1000 (y - total) y total 1000 if (i * 10000 + j * 5000 + k * 1000 == y && i + j + k == n) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = k;
                    ok = false;
                    break;
                } i * 10000 + j * 5000 + k * 1000 == y && i + j + k == n i * 10000 + j * 5000 + k * 1000 == y i * 10000 + j * 5000 + k * 1000 i * 10000 + j * 5000 + k * 1000 i * 10000 i 10000 j * 5000 j 5000 k * 1000 k 1000 y i + j + k == n i + j + k i + j + k i j k n {
                    a10000 = i;
                    a5000 = j;
                    a1000 = k;
                    ok = false;
                    break;
                } a10000 = i a10000 i a5000 = j a5000 j a1000 = k a1000 k ok = false ok false break; System.out.println(a10000 + " " + a5000 + " " + a1000) System.out.println System.out System System.out a10000 + " " + a5000 + " " + a1000 " " a5000 a10000 + " " + a5000 + " " + a1000 a10000 " " a5000 " " a1000 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long n = s.nextLong(), y = s.nextLong();
        long mx = -1;
        long a10000 = -1, a5000 = -1, a1000 = -1;
        boolean ok = true;
        for(long i = 0; i <= y / 10000 && ok; ++i) {
            for(long j = 0; j <= (y - i * 10000)/ 5000; ++j) {
                long total = i * 10000 + j * 5000;
                long k = (y - total) / 1000;
                if (i * 10000 + j * 5000 + k * 1000 == y && i + j + k == n) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = k;
                    ok = false;
                    break;
                }
            }
        }
        System.out.println(a10000 + " " + a5000 + " " + a1000);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long n = s.nextLong(), y = s.nextLong();
        long mx = -1;
        long a10000 = -1, a5000 = -1, a1000 = -1;
        boolean ok = true;
        for(long i = 0; i <= y / 10000 && ok; ++i) {
            for(long j = 0; j <= (y - i * 10000)/ 5000; ++j) {
                long total = i * 10000 + j * 5000;
                long k = (y - total) / 1000;
                if (i * 10000 + j * 5000 + k * 1000 == y && i + j + k == n) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = k;
                    ok = false;
                    break;
                }
            }
        }
        System.out.println(a10000 + " " + a5000 + " " + a1000);
    }
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long n = s.nextLong(), y = s.nextLong();
        long mx = -1;
        long a10000 = -1, a5000 = -1, a1000 = -1;
        boolean ok = true;
        for(long i = 0; i <= y / 10000 && ok; ++i) {
            for(long j = 0; j <= (y - i * 10000)/ 5000; ++j) {
                long total = i * 10000 + j * 5000;
                long k = (y - total) / 1000;
                if (i * 10000 + j * 5000 + k * 1000 == y && i + j + k == n) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = k;
                    ok = false;
                    break;
                }
            }
        }
        System.out.println(a10000 + " " + a5000 + " " + a1000);
    }
}
