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 a=-1;
        int b=-1;
        int c=-1;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=n;j++){
                    if(y/1000-10*i-5*j==n-j-i && n-j-i>=0){
                        a=i; b=j; c=n-i-j;
                        break;
                }
            }
        }
        System.out.println(a+" "+b+" "+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 a=-1;
        int b=-1;
        int c=-1;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=n;j++){
                    if(y/1000-10*i-5*j==n-j-i && n-j-i>=0){
                        a=i; b=j; c=n-i-j;
                        break;
                }
            }
        }
        System.out.println(a+" "+b+" "+c);
        
    }
} Main public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int y=sc.nextInt();
        int a=-1;
        int b=-1;
        int c=-1;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=n;j++){
                    if(y/1000-10*i-5*j==n-j-i && n-j-i>=0){
                        a=i; b=j; c=n-i-j;
                        break;
                }
            }
        }
        System.out.println(a+" "+b+" "+c);
        
    } main {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int y=sc.nextInt();
        int a=-1;
        int b=-1;
        int c=-1;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=n;j++){
                    if(y/1000-10*i-5*j==n-j-i && n-j-i>=0){
                        a=i; b=j; c=n-i-j;
                        break;
                }
            }
        }
        System.out.println(a+" "+b+" "+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 a=-1; a -1 1 int b=-1; b -1 1 int c=-1; c -1 1 for(int i=0;i<=n;i++){
            for(int j=0;j<=n;j++){
                    if(y/1000-10*i-5*j==n-j-i && n-j-i>=0){
                        a=i; b=j; c=n-i-j;
                        break;
                }
            }
        } int i=0; int i=0; i 0 i<=n i n i++ i++ i {
            for(int j=0;j<=n;j++){
                    if(y/1000-10*i-5*j==n-j-i && n-j-i>=0){
                        a=i; b=j; c=n-i-j;
                        break;
                }
            }
        } {
            for(int j=0;j<=n;j++){
                    if(y/1000-10*i-5*j==n-j-i && n-j-i>=0){
                        a=i; b=j; c=n-i-j;
                        break;
                }
            }
        } for(int j=0;j<=n;j++){
                    if(y/1000-10*i-5*j==n-j-i && n-j-i>=0){
                        a=i; b=j; c=n-i-j;
                        break;
                }
            } int j=0; int j=0; j 0 j<=n j n j++ j++ j {
                    if(y/1000-10*i-5*j==n-j-i && n-j-i>=0){
                        a=i; b=j; c=n-i-j;
                        break;
                }
            } {
                    if(y/1000-10*i-5*j==n-j-i && n-j-i>=0){
                        a=i; b=j; c=n-i-j;
                        break;
                }
            } if(y/1000-10*i-5*j==n-j-i && n-j-i>=0){
                        a=i; b=j; c=n-i-j;
                        break;
                } y/1000-10*i-5*j==n-j-i && n-j-i>=0 y/1000-10*i-5*j==n-j-i y/1000-10*i-5*j y/1000-10*i-5*j y/1000 y 1000 10*i 10 i 5*j 5 j n-j-i n-j-i n j i n-j-i>=0 n-j-i n-j-i n j i 0 {
                        a=i; b=j; c=n-i-j;
                        break;
                } a=i a i b=j b j c=n-i-j c n-i-j n-i-j n i j break; System.out.println(a+" "+b+" "+c) System.out.println System.out System System.out a+" "+b+" "+c " " b a+" "+b+" "+c a " " b " " 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 a=-1;
        int b=-1;
        int c=-1;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=n;j++){
                    if(y/1000-10*i-5*j==n-j-i && n-j-i>=0){
                        a=i; b=j; c=n-i-j;
                        break;
                }
            }
        }
        System.out.println(a+" "+b+" "+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 a=-1;
        int b=-1;
        int c=-1;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=n;j++){
                    if(y/1000-10*i-5*j==n-j-i && n-j-i>=0){
                        a=i; b=j; c=n-i-j;
                        break;
                }
            }
        }
        System.out.println(a+" "+b+" "+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 a=-1;
        int b=-1;
        int c=-1;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=n;j++){
                    if(y/1000-10*i-5*j==n-j-i && n-j-i>=0){
                        a=i; b=j; c=n-i-j;
                        break;
                }
            }
        }
        System.out.println(a+" "+b+" "+c);
        
    }
}