import 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();
        int Z = Y/1000 - N;
        int a;
        int b = 0;
        int c;
        while(true) {
            int x = Z - 4*b;

            if (b >= 2000 || x < 0) {
                a = -1;
                b = -1;
                c = -1;
                break;
            }

            if(x % 9 == 0) {
                a = x / 9;
                c = N - a - b;
                if (c >= 0) {
                    break;
                }
            }
            b += 1;
        }
        System.out.print(a);
        System.out.print(' ');
        System.out.print(b);
        System.out.print(' ');
        System.out.print(c);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int Z = Y/1000 - N;
        int a;
        int b = 0;
        int c;
        while(true) {
            int x = Z - 4*b;

            if (b >= 2000 || x < 0) {
                a = -1;
                b = -1;
                c = -1;
                break;
            }

            if(x % 9 == 0) {
                a = x / 9;
                c = N - a - b;
                if (c >= 0) {
                    break;
                }
            }
            b += 1;
        }
        System.out.print(a);
        System.out.print(' ');
        System.out.print(b);
        System.out.print(' ');
        System.out.print(c);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int Z = Y/1000 - N;
        int a;
        int b = 0;
        int c;
        while(true) {
            int x = Z - 4*b;

            if (b >= 2000 || x < 0) {
                a = -1;
                b = -1;
                c = -1;
                break;
            }

            if(x % 9 == 0) {
                a = x / 9;
                c = N - a - b;
                if (c >= 0) {
                    break;
                }
            }
            b += 1;
        }
        System.out.print(a);
        System.out.print(' ');
        System.out.print(b);
        System.out.print(' ');
        System.out.print(c);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int Z = Y/1000 - N;
        int a;
        int b = 0;
        int c;
        while(true) {
            int x = Z - 4*b;

            if (b >= 2000 || x < 0) {
                a = -1;
                b = -1;
                c = -1;
                break;
            }

            if(x % 9 == 0) {
                a = x / 9;
                c = N - a - b;
                if (c >= 0) {
                    break;
                }
            }
            b += 1;
        }
        System.out.print(a);
        System.out.print(' ');
        System.out.print(b);
        System.out.print(' ');
        System.out.print(c);
    } 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 int Z = Y/1000 - N; Z Y/1000 - N Y/1000 Y 1000 N int a; a int b = 0; b 0 int c; c while(true) {
            int x = Z - 4*b;

            if (b >= 2000 || x < 0) {
                a = -1;
                b = -1;
                c = -1;
                break;
            }

            if(x % 9 == 0) {
                a = x / 9;
                c = N - a - b;
                if (c >= 0) {
                    break;
                }
            }
            b += 1;
        } true {
            int x = Z - 4*b;

            if (b >= 2000 || x < 0) {
                a = -1;
                b = -1;
                c = -1;
                break;
            }

            if(x % 9 == 0) {
                a = x / 9;
                c = N - a - b;
                if (c >= 0) {
                    break;
                }
            }
            b += 1;
        } int x = Z - 4*b; x Z - 4*b Z 4*b 4 b if (b >= 2000 || x < 0) {
                a = -1;
                b = -1;
                c = -1;
                break;
            } b >= 2000 || x < 0 b >= 2000 b 2000 x < 0 x 0 {
                a = -1;
                b = -1;
                c = -1;
                break;
            } a = -1 a -1 1 b = -1 b -1 1 c = -1 c -1 1 break; if(x % 9 == 0) {
                a = x / 9;
                c = N - a - b;
                if (c >= 0) {
                    break;
                }
            } x % 9 == 0 x % 9 x 9 0 {
                a = x / 9;
                c = N - a - b;
                if (c >= 0) {
                    break;
                }
            } a = x / 9 a x / 9 x 9 c = N - a - b c N - a - b N - a - b N a b if (c >= 0) {
                    break;
                } c >= 0 c 0 {
                    break;
                } break; b += 1 b 1 System.out.print(a) System.out.print System.out System System.out a System.out.print(' ') System.out.print System.out System System.out ' ' System.out.print(b) System.out.print System.out System System.out b System.out.print(' ') System.out.print System.out System System.out ' ' System.out.print(c) System.out.print System.out System System.out c 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();
        int Z = Y/1000 - N;
        int a;
        int b = 0;
        int c;
        while(true) {
            int x = Z - 4*b;

            if (b >= 2000 || x < 0) {
                a = -1;
                b = -1;
                c = -1;
                break;
            }

            if(x % 9 == 0) {
                a = x / 9;
                c = N - a - b;
                if (c >= 0) {
                    break;
                }
            }
            b += 1;
        }
        System.out.print(a);
        System.out.print(' ');
        System.out.print(b);
        System.out.print(' ');
        System.out.print(c);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        int Z = Y/1000 - N;
        int a;
        int b = 0;
        int c;
        while(true) {
            int x = Z - 4*b;

            if (b >= 2000 || x < 0) {
                a = -1;
                b = -1;
                c = -1;
                break;
            }

            if(x % 9 == 0) {
                a = x / 9;
                c = N - a - b;
                if (c >= 0) {
                    break;
                }
            }
            b += 1;
        }
        System.out.print(a);
        System.out.print(' ');
        System.out.print(b);
        System.out.print(' ');
        System.out.print(c);
    }
} Main
import 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();
        int Z = Y/1000 - N;
        int a;
        int b = 0;
        int c;
        while(true) {
            int x = Z - 4*b;

            if (b >= 2000 || x < 0) {
                a = -1;
                b = -1;
                c = -1;
                break;
            }

            if(x % 9 == 0) {
                a = x / 9;
                c = N - a - b;
                if (c >= 0) {
                    break;
                }
            }
            b += 1;
        }
        System.out.print(a);
        System.out.print(' ');
        System.out.print(b);
        System.out.print(' ');
        System.out.print(c);
    }
}