import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int Y = scan.nextInt();
        int[] a = new int[3];
        Arrays.fill(a, -1);
        boolean found = false;
        for (int i = 0; i <= N; i++) {
            if (Y < i * 10000) {
                continue;
            }
            int remain1 = Y - i * 10000;
            for (int j = 0; j <= N - i; j++) {
                if (remain1 < j * 5000) {
                    continue;
                }
                int remain2 = remain1 - j * 5000;
                if (N - i - j == remain2 / 1000) {
                    a[0] = i;
                    a[1] = j;
                    a[2] = N - i - j;
                    break;
                }
            }
            if (found) {
                break;
            }
        }
        System.out.printf("%d %d %d\n",a[0],a[1],a[2]);

    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int Y = scan.nextInt();
        int[] a = new int[3];
        Arrays.fill(a, -1);
        boolean found = false;
        for (int i = 0; i <= N; i++) {
            if (Y < i * 10000) {
                continue;
            }
            int remain1 = Y - i * 10000;
            for (int j = 0; j <= N - i; j++) {
                if (remain1 < j * 5000) {
                    continue;
                }
                int remain2 = remain1 - j * 5000;
                if (N - i - j == remain2 / 1000) {
                    a[0] = i;
                    a[1] = j;
                    a[2] = N - i - j;
                    break;
                }
            }
            if (found) {
                break;
            }
        }
        System.out.printf("%d %d %d\n",a[0],a[1],a[2]);

    }
} Main public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    } main {
        Main main = new Main();
        main.solve();
    } Main main = new Main(); main new Main() main.solve() main.solve main String[] args args public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int Y = scan.nextInt();
        int[] a = new int[3];
        Arrays.fill(a, -1);
        boolean found = false;
        for (int i = 0; i <= N; i++) {
            if (Y < i * 10000) {
                continue;
            }
            int remain1 = Y - i * 10000;
            for (int j = 0; j <= N - i; j++) {
                if (remain1 < j * 5000) {
                    continue;
                }
                int remain2 = remain1 - j * 5000;
                if (N - i - j == remain2 / 1000) {
                    a[0] = i;
                    a[1] = j;
                    a[2] = N - i - j;
                    break;
                }
            }
            if (found) {
                break;
            }
        }
        System.out.printf("%d %d %d\n",a[0],a[1],a[2]);

    } solve {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int Y = scan.nextInt();
        int[] a = new int[3];
        Arrays.fill(a, -1);
        boolean found = false;
        for (int i = 0; i <= N; i++) {
            if (Y < i * 10000) {
                continue;
            }
            int remain1 = Y - i * 10000;
            for (int j = 0; j <= N - i; j++) {
                if (remain1 < j * 5000) {
                    continue;
                }
                int remain2 = remain1 - j * 5000;
                if (N - i - j == remain2 / 1000) {
                    a[0] = i;
                    a[1] = j;
                    a[2] = N - i - j;
                    break;
                }
            }
            if (found) {
                break;
            }
        }
        System.out.printf("%d %d %d\n",a[0],a[1],a[2]);

    } Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in))); scan new Scanner(new BufferedReader(new InputStreamReader(System.in))) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int Y = scan.nextInt(); Y scan.nextInt() scan.nextInt scan int[] a = new int[3]; a new int[3] 3 Arrays.fill(a, -1) Arrays.fill Arrays a -1 1 boolean found = false; found false for (int i = 0; i <= N; i++) {
            if (Y < i * 10000) {
                continue;
            }
            int remain1 = Y - i * 10000;
            for (int j = 0; j <= N - i; j++) {
                if (remain1 < j * 5000) {
                    continue;
                }
                int remain2 = remain1 - j * 5000;
                if (N - i - j == remain2 / 1000) {
                    a[0] = i;
                    a[1] = j;
                    a[2] = N - i - j;
                    break;
                }
            }
            if (found) {
                break;
            }
        } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
            if (Y < i * 10000) {
                continue;
            }
            int remain1 = Y - i * 10000;
            for (int j = 0; j <= N - i; j++) {
                if (remain1 < j * 5000) {
                    continue;
                }
                int remain2 = remain1 - j * 5000;
                if (N - i - j == remain2 / 1000) {
                    a[0] = i;
                    a[1] = j;
                    a[2] = N - i - j;
                    break;
                }
            }
            if (found) {
                break;
            }
        } {
            if (Y < i * 10000) {
                continue;
            }
            int remain1 = Y - i * 10000;
            for (int j = 0; j <= N - i; j++) {
                if (remain1 < j * 5000) {
                    continue;
                }
                int remain2 = remain1 - j * 5000;
                if (N - i - j == remain2 / 1000) {
                    a[0] = i;
                    a[1] = j;
                    a[2] = N - i - j;
                    break;
                }
            }
            if (found) {
                break;
            }
        } if (Y < i * 10000) {
                continue;
            } Y < i * 10000 Y i * 10000 i 10000 {
                continue;
            } continue; int remain1 = Y - i * 10000; remain1 Y - i * 10000 Y i * 10000 i 10000 for (int j = 0; j <= N - i; j++) {
                if (remain1 < j * 5000) {
                    continue;
                }
                int remain2 = remain1 - j * 5000;
                if (N - i - j == remain2 / 1000) {
                    a[0] = i;
                    a[1] = j;
                    a[2] = N - i - j;
                    break;
                }
            } int j = 0; int j = 0; j 0 j <= N - i j N - i N i j++ j++ j {
                if (remain1 < j * 5000) {
                    continue;
                }
                int remain2 = remain1 - j * 5000;
                if (N - i - j == remain2 / 1000) {
                    a[0] = i;
                    a[1] = j;
                    a[2] = N - i - j;
                    break;
                }
            } {
                if (remain1 < j * 5000) {
                    continue;
                }
                int remain2 = remain1 - j * 5000;
                if (N - i - j == remain2 / 1000) {
                    a[0] = i;
                    a[1] = j;
                    a[2] = N - i - j;
                    break;
                }
            } if (remain1 < j * 5000) {
                    continue;
                } remain1 < j * 5000 remain1 j * 5000 j 5000 {
                    continue;
                } continue; int remain2 = remain1 - j * 5000; remain2 remain1 - j * 5000 remain1 j * 5000 j 5000 if (N - i - j == remain2 / 1000) {
                    a[0] = i;
                    a[1] = j;
                    a[2] = N - i - j;
                    break;
                } N - i - j == remain2 / 1000 N - i - j N - i - j N i j remain2 / 1000 remain2 1000 {
                    a[0] = i;
                    a[1] = j;
                    a[2] = N - i - j;
                    break;
                } a[0] = i a[0] a 0 i a[1] = j a[1] a 1 j a[2] = N - i - j a[2] a 2 N - i - j N - i - j N i j break; if (found) {
                break;
            } found {
                break;
            } break; System.out.printf("%d %d %d\n",a[0],a[1],a[2]) System.out.printf System.out System System.out "%d %d %d\n" a[0] a 0 a[1] a 1 a[2] a 2 public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int Y = scan.nextInt();
        int[] a = new int[3];
        Arrays.fill(a, -1);
        boolean found = false;
        for (int i = 0; i <= N; i++) {
            if (Y < i * 10000) {
                continue;
            }
            int remain1 = Y - i * 10000;
            for (int j = 0; j <= N - i; j++) {
                if (remain1 < j * 5000) {
                    continue;
                }
                int remain2 = remain1 - j * 5000;
                if (N - i - j == remain2 / 1000) {
                    a[0] = i;
                    a[1] = j;
                    a[2] = N - i - j;
                    break;
                }
            }
            if (found) {
                break;
            }
        }
        System.out.printf("%d %d %d\n",a[0],a[1],a[2]);

    }
} public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int Y = scan.nextInt();
        int[] a = new int[3];
        Arrays.fill(a, -1);
        boolean found = false;
        for (int i = 0; i <= N; i++) {
            if (Y < i * 10000) {
                continue;
            }
            int remain1 = Y - i * 10000;
            for (int j = 0; j <= N - i; j++) {
                if (remain1 < j * 5000) {
                    continue;
                }
                int remain2 = remain1 - j * 5000;
                if (N - i - j == remain2 / 1000) {
                    a[0] = i;
                    a[1] = j;
                    a[2] = N - i - j;
                    break;
                }
            }
            if (found) {
                break;
            }
        }
        System.out.printf("%d %d %d\n",a[0],a[1],a[2]);

    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int Y = scan.nextInt();
        int[] a = new int[3];
        Arrays.fill(a, -1);
        boolean found = false;
        for (int i = 0; i <= N; i++) {
            if (Y < i * 10000) {
                continue;
            }
            int remain1 = Y - i * 10000;
            for (int j = 0; j <= N - i; j++) {
                if (remain1 < j * 5000) {
                    continue;
                }
                int remain2 = remain1 - j * 5000;
                if (N - i - j == remain2 / 1000) {
                    a[0] = i;
                    a[1] = j;
                    a[2] = N - i - j;
                    break;
                }
            }
            if (found) {
                break;
            }
        }
        System.out.printf("%d %d %d\n",a[0],a[1],a[2]);

    }
}
