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();
        sc.close();

        int cnt1 = 0;
        int cnt2 = 0;
        int cnt3 = 0;
        boolean isFound = false;
        for(int i=0; i<n; i++) {
            if(y == 10000*n) {
                cnt1 = n;
                isFound = true;
                break;
            }

            int tmp1 = 0;
            if(y - (i * 10000) > 0) {
                tmp1 = y - (i * 10000);
            }
            cnt1 = i;

            for(int j=0; j<n-i; j++) {
                if(tmp1 == 5000 * (n-i)) {
                    cnt2 = n-i;
                    isFound = true;
                    break;
                }
                int tmp2 = 0;
                if (tmp1 - (5000 * j) > 0) {
                    tmp2 = tmp1 - (5000 * j);
                }
                cnt2 = j;

                if(tmp2 == 1000*(n-i-j)) {
                    cnt3 = n-i-j;
                    isFound = true;
                    break;
                }
            }
            if(isFound) {
                break;
            }
        }

        if(!isFound) {
            System.out.println("-1" + " " + "-1" + " " + "-1");
        } else {
            System.out.println(Integer.toString(cnt1) + " " + Integer.toString(cnt2) + " " + Integer.toString(cnt3));
        }
    }
} 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();
        sc.close();

        int cnt1 = 0;
        int cnt2 = 0;
        int cnt3 = 0;
        boolean isFound = false;
        for(int i=0; i<n; i++) {
            if(y == 10000*n) {
                cnt1 = n;
                isFound = true;
                break;
            }

            int tmp1 = 0;
            if(y - (i * 10000) > 0) {
                tmp1 = y - (i * 10000);
            }
            cnt1 = i;

            for(int j=0; j<n-i; j++) {
                if(tmp1 == 5000 * (n-i)) {
                    cnt2 = n-i;
                    isFound = true;
                    break;
                }
                int tmp2 = 0;
                if (tmp1 - (5000 * j) > 0) {
                    tmp2 = tmp1 - (5000 * j);
                }
                cnt2 = j;

                if(tmp2 == 1000*(n-i-j)) {
                    cnt3 = n-i-j;
                    isFound = true;
                    break;
                }
            }
            if(isFound) {
                break;
            }
        }

        if(!isFound) {
            System.out.println("-1" + " " + "-1" + " " + "-1");
        } else {
            System.out.println(Integer.toString(cnt1) + " " + Integer.toString(cnt2) + " " + Integer.toString(cnt3));
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        sc.close();

        int cnt1 = 0;
        int cnt2 = 0;
        int cnt3 = 0;
        boolean isFound = false;
        for(int i=0; i<n; i++) {
            if(y == 10000*n) {
                cnt1 = n;
                isFound = true;
                break;
            }

            int tmp1 = 0;
            if(y - (i * 10000) > 0) {
                tmp1 = y - (i * 10000);
            }
            cnt1 = i;

            for(int j=0; j<n-i; j++) {
                if(tmp1 == 5000 * (n-i)) {
                    cnt2 = n-i;
                    isFound = true;
                    break;
                }
                int tmp2 = 0;
                if (tmp1 - (5000 * j) > 0) {
                    tmp2 = tmp1 - (5000 * j);
                }
                cnt2 = j;

                if(tmp2 == 1000*(n-i-j)) {
                    cnt3 = n-i-j;
                    isFound = true;
                    break;
                }
            }
            if(isFound) {
                break;
            }
        }

        if(!isFound) {
            System.out.println("-1" + " " + "-1" + " " + "-1");
        } else {
            System.out.println(Integer.toString(cnt1) + " " + Integer.toString(cnt2) + " " + Integer.toString(cnt3));
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        sc.close();

        int cnt1 = 0;
        int cnt2 = 0;
        int cnt3 = 0;
        boolean isFound = false;
        for(int i=0; i<n; i++) {
            if(y == 10000*n) {
                cnt1 = n;
                isFound = true;
                break;
            }

            int tmp1 = 0;
            if(y - (i * 10000) > 0) {
                tmp1 = y - (i * 10000);
            }
            cnt1 = i;

            for(int j=0; j<n-i; j++) {
                if(tmp1 == 5000 * (n-i)) {
                    cnt2 = n-i;
                    isFound = true;
                    break;
                }
                int tmp2 = 0;
                if (tmp1 - (5000 * j) > 0) {
                    tmp2 = tmp1 - (5000 * j);
                }
                cnt2 = j;

                if(tmp2 == 1000*(n-i-j)) {
                    cnt3 = n-i-j;
                    isFound = true;
                    break;
                }
            }
            if(isFound) {
                break;
            }
        }

        if(!isFound) {
            System.out.println("-1" + " " + "-1" + " " + "-1");
        } else {
            System.out.println(Integer.toString(cnt1) + " " + Integer.toString(cnt2) + " " + Integer.toString(cnt3));
        }
    } 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 sc.close() sc.close sc int cnt1 = 0; cnt1 0 int cnt2 = 0; cnt2 0 int cnt3 = 0; cnt3 0 boolean isFound = false; isFound false for(int i=0; i<n; i++) {
            if(y == 10000*n) {
                cnt1 = n;
                isFound = true;
                break;
            }

            int tmp1 = 0;
            if(y - (i * 10000) > 0) {
                tmp1 = y - (i * 10000);
            }
            cnt1 = i;

            for(int j=0; j<n-i; j++) {
                if(tmp1 == 5000 * (n-i)) {
                    cnt2 = n-i;
                    isFound = true;
                    break;
                }
                int tmp2 = 0;
                if (tmp1 - (5000 * j) > 0) {
                    tmp2 = tmp1 - (5000 * j);
                }
                cnt2 = j;

                if(tmp2 == 1000*(n-i-j)) {
                    cnt3 = n-i-j;
                    isFound = true;
                    break;
                }
            }
            if(isFound) {
                break;
            }
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            if(y == 10000*n) {
                cnt1 = n;
                isFound = true;
                break;
            }

            int tmp1 = 0;
            if(y - (i * 10000) > 0) {
                tmp1 = y - (i * 10000);
            }
            cnt1 = i;

            for(int j=0; j<n-i; j++) {
                if(tmp1 == 5000 * (n-i)) {
                    cnt2 = n-i;
                    isFound = true;
                    break;
                }
                int tmp2 = 0;
                if (tmp1 - (5000 * j) > 0) {
                    tmp2 = tmp1 - (5000 * j);
                }
                cnt2 = j;

                if(tmp2 == 1000*(n-i-j)) {
                    cnt3 = n-i-j;
                    isFound = true;
                    break;
                }
            }
            if(isFound) {
                break;
            }
        } {
            if(y == 10000*n) {
                cnt1 = n;
                isFound = true;
                break;
            }

            int tmp1 = 0;
            if(y - (i * 10000) > 0) {
                tmp1 = y - (i * 10000);
            }
            cnt1 = i;

            for(int j=0; j<n-i; j++) {
                if(tmp1 == 5000 * (n-i)) {
                    cnt2 = n-i;
                    isFound = true;
                    break;
                }
                int tmp2 = 0;
                if (tmp1 - (5000 * j) > 0) {
                    tmp2 = tmp1 - (5000 * j);
                }
                cnt2 = j;

                if(tmp2 == 1000*(n-i-j)) {
                    cnt3 = n-i-j;
                    isFound = true;
                    break;
                }
            }
            if(isFound) {
                break;
            }
        } if(y == 10000*n) {
                cnt1 = n;
                isFound = true;
                break;
            } y == 10000*n y 10000*n 10000 n {
                cnt1 = n;
                isFound = true;
                break;
            } cnt1 = n cnt1 n isFound = true isFound true break; int tmp1 = 0; tmp1 0 if(y - (i * 10000) > 0) {
                tmp1 = y - (i * 10000);
            } y - (i * 10000) > 0 y - (i * 10000) y (i * 10000) i 10000 0 {
                tmp1 = y - (i * 10000);
            } tmp1 = y - (i * 10000) tmp1 y - (i * 10000) y (i * 10000) i 10000 cnt1 = i cnt1 i for(int j=0; j<n-i; j++) {
                if(tmp1 == 5000 * (n-i)) {
                    cnt2 = n-i;
                    isFound = true;
                    break;
                }
                int tmp2 = 0;
                if (tmp1 - (5000 * j) > 0) {
                    tmp2 = tmp1 - (5000 * j);
                }
                cnt2 = j;

                if(tmp2 == 1000*(n-i-j)) {
                    cnt3 = n-i-j;
                    isFound = true;
                    break;
                }
            } int j=0; int j=0; j 0 j<n-i j n-i n i j++ j++ j {
                if(tmp1 == 5000 * (n-i)) {
                    cnt2 = n-i;
                    isFound = true;
                    break;
                }
                int tmp2 = 0;
                if (tmp1 - (5000 * j) > 0) {
                    tmp2 = tmp1 - (5000 * j);
                }
                cnt2 = j;

                if(tmp2 == 1000*(n-i-j)) {
                    cnt3 = n-i-j;
                    isFound = true;
                    break;
                }
            } {
                if(tmp1 == 5000 * (n-i)) {
                    cnt2 = n-i;
                    isFound = true;
                    break;
                }
                int tmp2 = 0;
                if (tmp1 - (5000 * j) > 0) {
                    tmp2 = tmp1 - (5000 * j);
                }
                cnt2 = j;

                if(tmp2 == 1000*(n-i-j)) {
                    cnt3 = n-i-j;
                    isFound = true;
                    break;
                }
            } if(tmp1 == 5000 * (n-i)) {
                    cnt2 = n-i;
                    isFound = true;
                    break;
                } tmp1 == 5000 * (n-i) tmp1 5000 * (n-i) 5000 (n-i) n i {
                    cnt2 = n-i;
                    isFound = true;
                    break;
                } cnt2 = n-i cnt2 n-i n i isFound = true isFound true break; int tmp2 = 0; tmp2 0 if (tmp1 - (5000 * j) > 0) {
                    tmp2 = tmp1 - (5000 * j);
                } tmp1 - (5000 * j) > 0 tmp1 - (5000 * j) tmp1 (5000 * j) 5000 j 0 {
                    tmp2 = tmp1 - (5000 * j);
                } tmp2 = tmp1 - (5000 * j) tmp2 tmp1 - (5000 * j) tmp1 (5000 * j) 5000 j cnt2 = j cnt2 j if(tmp2 == 1000*(n-i-j)) {
                    cnt3 = n-i-j;
                    isFound = true;
                    break;
                } tmp2 == 1000*(n-i-j) tmp2 1000*(n-i-j) 1000 (n-i-j) n-i-j n i j {
                    cnt3 = n-i-j;
                    isFound = true;
                    break;
                } cnt3 = n-i-j cnt3 n-i-j n-i-j n i j isFound = true isFound true break; if(isFound) {
                break;
            } isFound {
                break;
            } break; if(!isFound) {
            System.out.println("-1" + " " + "-1" + " " + "-1");
        } else {
            System.out.println(Integer.toString(cnt1) + " " + Integer.toString(cnt2) + " " + Integer.toString(cnt3));
        } !isFound isFound {
            System.out.println("-1" + " " + "-1" + " " + "-1");
        } System.out.println("-1" + " " + "-1" + " " + "-1") System.out.println System.out System System.out "-1" + " " + "-1" + " " + "-1" " " "-1" "-1" + " " + "-1" + " " + "-1" "-1" " " "-1" " " "-1" {
            System.out.println(Integer.toString(cnt1) + " " + Integer.toString(cnt2) + " " + Integer.toString(cnt3));
        } System.out.println(Integer.toString(cnt1) + " " + Integer.toString(cnt2) + " " + Integer.toString(cnt3)) System.out.println System.out System System.out Integer.toString(cnt1) + " " + Integer.toString(cnt2) + " " + Integer.toString(cnt3) " " Integer.toString(cnt2) Integer.toString(cnt1) + " " + Integer.toString(cnt2) + " " + Integer.toString(cnt3) Integer.toString(cnt1) Integer.toString Integer cnt1 " " Integer.toString(cnt2) Integer.toString Integer cnt2 " " Integer.toString(cnt3) Integer.toString Integer cnt3 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();
        sc.close();

        int cnt1 = 0;
        int cnt2 = 0;
        int cnt3 = 0;
        boolean isFound = false;
        for(int i=0; i<n; i++) {
            if(y == 10000*n) {
                cnt1 = n;
                isFound = true;
                break;
            }

            int tmp1 = 0;
            if(y - (i * 10000) > 0) {
                tmp1 = y - (i * 10000);
            }
            cnt1 = i;

            for(int j=0; j<n-i; j++) {
                if(tmp1 == 5000 * (n-i)) {
                    cnt2 = n-i;
                    isFound = true;
                    break;
                }
                int tmp2 = 0;
                if (tmp1 - (5000 * j) > 0) {
                    tmp2 = tmp1 - (5000 * j);
                }
                cnt2 = j;

                if(tmp2 == 1000*(n-i-j)) {
                    cnt3 = n-i-j;
                    isFound = true;
                    break;
                }
            }
            if(isFound) {
                break;
            }
        }

        if(!isFound) {
            System.out.println("-1" + " " + "-1" + " " + "-1");
        } else {
            System.out.println(Integer.toString(cnt1) + " " + Integer.toString(cnt2) + " " + Integer.toString(cnt3));
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        sc.close();

        int cnt1 = 0;
        int cnt2 = 0;
        int cnt3 = 0;
        boolean isFound = false;
        for(int i=0; i<n; i++) {
            if(y == 10000*n) {
                cnt1 = n;
                isFound = true;
                break;
            }

            int tmp1 = 0;
            if(y - (i * 10000) > 0) {
                tmp1 = y - (i * 10000);
            }
            cnt1 = i;

            for(int j=0; j<n-i; j++) {
                if(tmp1 == 5000 * (n-i)) {
                    cnt2 = n-i;
                    isFound = true;
                    break;
                }
                int tmp2 = 0;
                if (tmp1 - (5000 * j) > 0) {
                    tmp2 = tmp1 - (5000 * j);
                }
                cnt2 = j;

                if(tmp2 == 1000*(n-i-j)) {
                    cnt3 = n-i-j;
                    isFound = true;
                    break;
                }
            }
            if(isFound) {
                break;
            }
        }

        if(!isFound) {
            System.out.println("-1" + " " + "-1" + " " + "-1");
        } else {
            System.out.println(Integer.toString(cnt1) + " " + Integer.toString(cnt2) + " " + Integer.toString(cnt3));
        }
    }
} 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();
        sc.close();

        int cnt1 = 0;
        int cnt2 = 0;
        int cnt3 = 0;
        boolean isFound = false;
        for(int i=0; i<n; i++) {
            if(y == 10000*n) {
                cnt1 = n;
                isFound = true;
                break;
            }

            int tmp1 = 0;
            if(y - (i * 10000) > 0) {
                tmp1 = y - (i * 10000);
            }
            cnt1 = i;

            for(int j=0; j<n-i; j++) {
                if(tmp1 == 5000 * (n-i)) {
                    cnt2 = n-i;
                    isFound = true;
                    break;
                }
                int tmp2 = 0;
                if (tmp1 - (5000 * j) > 0) {
                    tmp2 = tmp1 - (5000 * j);
                }
                cnt2 = j;

                if(tmp2 == 1000*(n-i-j)) {
                    cnt3 = n-i-j;
                    isFound = true;
                    break;
                }
            }
            if(isFound) {
                break;
            }
        }

        if(!isFound) {
            System.out.println("-1" + " " + "-1" + " " + "-1");
        } else {
            System.out.println(Integer.toString(cnt1) + " " + Integer.toString(cnt2) + " " + Integer.toString(cnt3));
        }
    }
}
