import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner dataScanner = new Scanner(System.in);
        String[] data = dataScanner.nextLine().split(" ");
        int numCards = Integer.parseInt(data[0]);
        int goal = Integer.parseInt(data[1]);
        boolean foundPair = false;
        Integer[] pair = new Integer[3];
        int otoshidama = 0;
        outerloop:
        for (Integer i = 0; i < Math.max(numCards,0)+1; i++) {
            for (Integer j = 0; j < Math.max(numCards-i, 0)+1; j++) {
                int k = numCards - i - j;
                otoshidama = 10000 * i + 5000 * j + 1000 * k;
                if (otoshidama == goal) {
                    foundPair = true;
                    pair[0] = i;
                    pair[1] = j;
                    pair[2] = k;
                    break outerloop;
                }
            }
        }
        if (foundPair) {
            StringJoiner toPrint = new StringJoiner(" ");
            for (Integer number : pair) {
                toPrint.add(number.toString());
            }
            System.out.println(toPrint.toString());
        } else {
            System.out.println("-1 -1 -1");
        }
    }
} import java.util.*; util.* java import java.lang.*; lang.* java public class Main {
    public static void main(String[] args) {
        Scanner dataScanner = new Scanner(System.in);
        String[] data = dataScanner.nextLine().split(" ");
        int numCards = Integer.parseInt(data[0]);
        int goal = Integer.parseInt(data[1]);
        boolean foundPair = false;
        Integer[] pair = new Integer[3];
        int otoshidama = 0;
        outerloop:
        for (Integer i = 0; i < Math.max(numCards,0)+1; i++) {
            for (Integer j = 0; j < Math.max(numCards-i, 0)+1; j++) {
                int k = numCards - i - j;
                otoshidama = 10000 * i + 5000 * j + 1000 * k;
                if (otoshidama == goal) {
                    foundPair = true;
                    pair[0] = i;
                    pair[1] = j;
                    pair[2] = k;
                    break outerloop;
                }
            }
        }
        if (foundPair) {
            StringJoiner toPrint = new StringJoiner(" ");
            for (Integer number : pair) {
                toPrint.add(number.toString());
            }
            System.out.println(toPrint.toString());
        } else {
            System.out.println("-1 -1 -1");
        }
    }
} Main public static void main(String[] args) {
        Scanner dataScanner = new Scanner(System.in);
        String[] data = dataScanner.nextLine().split(" ");
        int numCards = Integer.parseInt(data[0]);
        int goal = Integer.parseInt(data[1]);
        boolean foundPair = false;
        Integer[] pair = new Integer[3];
        int otoshidama = 0;
        outerloop:
        for (Integer i = 0; i < Math.max(numCards,0)+1; i++) {
            for (Integer j = 0; j < Math.max(numCards-i, 0)+1; j++) {
                int k = numCards - i - j;
                otoshidama = 10000 * i + 5000 * j + 1000 * k;
                if (otoshidama == goal) {
                    foundPair = true;
                    pair[0] = i;
                    pair[1] = j;
                    pair[2] = k;
                    break outerloop;
                }
            }
        }
        if (foundPair) {
            StringJoiner toPrint = new StringJoiner(" ");
            for (Integer number : pair) {
                toPrint.add(number.toString());
            }
            System.out.println(toPrint.toString());
        } else {
            System.out.println("-1 -1 -1");
        }
    } main {
        Scanner dataScanner = new Scanner(System.in);
        String[] data = dataScanner.nextLine().split(" ");
        int numCards = Integer.parseInt(data[0]);
        int goal = Integer.parseInt(data[1]);
        boolean foundPair = false;
        Integer[] pair = new Integer[3];
        int otoshidama = 0;
        outerloop:
        for (Integer i = 0; i < Math.max(numCards,0)+1; i++) {
            for (Integer j = 0; j < Math.max(numCards-i, 0)+1; j++) {
                int k = numCards - i - j;
                otoshidama = 10000 * i + 5000 * j + 1000 * k;
                if (otoshidama == goal) {
                    foundPair = true;
                    pair[0] = i;
                    pair[1] = j;
                    pair[2] = k;
                    break outerloop;
                }
            }
        }
        if (foundPair) {
            StringJoiner toPrint = new StringJoiner(" ");
            for (Integer number : pair) {
                toPrint.add(number.toString());
            }
            System.out.println(toPrint.toString());
        } else {
            System.out.println("-1 -1 -1");
        }
    } Scanner dataScanner = new Scanner(System.in); dataScanner new Scanner(System.in) String[] data = dataScanner.nextLine().split(" "); data dataScanner.nextLine().split(" ") dataScanner.nextLine().split dataScanner.nextLine() dataScanner.nextLine dataScanner " " int numCards = Integer.parseInt(data[0]); numCards Integer.parseInt(data[0]) Integer.parseInt Integer data[0] data 0 int goal = Integer.parseInt(data[1]); goal Integer.parseInt(data[1]) Integer.parseInt Integer data[1] data 1 boolean foundPair = false; foundPair false Integer[] pair = new Integer[3]; pair new Integer[3] 3 int otoshidama = 0; otoshidama 0 if (foundPair) {
            StringJoiner toPrint = new StringJoiner(" ");
            for (Integer number : pair) {
                toPrint.add(number.toString());
            }
            System.out.println(toPrint.toString());
        } else {
            System.out.println("-1 -1 -1");
        } foundPair {
            StringJoiner toPrint = new StringJoiner(" ");
            for (Integer number : pair) {
                toPrint.add(number.toString());
            }
            System.out.println(toPrint.toString());
        } StringJoiner toPrint = new StringJoiner(" "); toPrint new StringJoiner(" ") for (Integer number : pair) {
                toPrint.add(number.toString());
            } Integer number pair {
                toPrint.add(number.toString());
            } {
                toPrint.add(number.toString());
            } toPrint.add(number.toString()) toPrint.add toPrint number.toString() number.toString number System.out.println(toPrint.toString()) System.out.println System.out System System.out toPrint.toString() toPrint.toString toPrint {
            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) {
        Scanner dataScanner = new Scanner(System.in);
        String[] data = dataScanner.nextLine().split(" ");
        int numCards = Integer.parseInt(data[0]);
        int goal = Integer.parseInt(data[1]);
        boolean foundPair = false;
        Integer[] pair = new Integer[3];
        int otoshidama = 0;
        outerloop:
        for (Integer i = 0; i < Math.max(numCards,0)+1; i++) {
            for (Integer j = 0; j < Math.max(numCards-i, 0)+1; j++) {
                int k = numCards - i - j;
                otoshidama = 10000 * i + 5000 * j + 1000 * k;
                if (otoshidama == goal) {
                    foundPair = true;
                    pair[0] = i;
                    pair[1] = j;
                    pair[2] = k;
                    break outerloop;
                }
            }
        }
        if (foundPair) {
            StringJoiner toPrint = new StringJoiner(" ");
            for (Integer number : pair) {
                toPrint.add(number.toString());
            }
            System.out.println(toPrint.toString());
        } else {
            System.out.println("-1 -1 -1");
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner dataScanner = new Scanner(System.in);
        String[] data = dataScanner.nextLine().split(" ");
        int numCards = Integer.parseInt(data[0]);
        int goal = Integer.parseInt(data[1]);
        boolean foundPair = false;
        Integer[] pair = new Integer[3];
        int otoshidama = 0;
        outerloop:
        for (Integer i = 0; i < Math.max(numCards,0)+1; i++) {
            for (Integer j = 0; j < Math.max(numCards-i, 0)+1; j++) {
                int k = numCards - i - j;
                otoshidama = 10000 * i + 5000 * j + 1000 * k;
                if (otoshidama == goal) {
                    foundPair = true;
                    pair[0] = i;
                    pair[1] = j;
                    pair[2] = k;
                    break outerloop;
                }
            }
        }
        if (foundPair) {
            StringJoiner toPrint = new StringJoiner(" ");
            for (Integer number : pair) {
                toPrint.add(number.toString());
            }
            System.out.println(toPrint.toString());
        } else {
            System.out.println("-1 -1 -1");
        }
    }
} Main
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner dataScanner = new Scanner(System.in);
        String[] data = dataScanner.nextLine().split(" ");
        int numCards = Integer.parseInt(data[0]);
        int goal = Integer.parseInt(data[1]);
        boolean foundPair = false;
        Integer[] pair = new Integer[3];
        int otoshidama = 0;
        outerloop:
        for (Integer i = 0; i < Math.max(numCards,0)+1; i++) {
            for (Integer j = 0; j < Math.max(numCards-i, 0)+1; j++) {
                int k = numCards - i - j;
                otoshidama = 10000 * i + 5000 * j + 1000 * k;
                if (otoshidama == goal) {
                    foundPair = true;
                    pair[0] = i;
                    pair[1] = j;
                    pair[2] = k;
                    break outerloop;
                }
            }
        }
        if (foundPair) {
            StringJoiner toPrint = new StringJoiner(" ");
            for (Integer number : pair) {
                toPrint.add(number.toString());
            }
            System.out.println(toPrint.toString());
        } else {
            System.out.println("-1 -1 -1");
        }
    }
}
