import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        
        for(int i = y/10000;i >= 0;i--)
            for(int j = 0;10000*i+5000*j <= y;j++){
                if(10000*i+5000*j+1000*(n-i-j) == y ){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    return;
                }
            }
                
            
        System.out.println((-1)+" "+(-1)+" "+(-1));
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        
        for(int i = y/10000;i >= 0;i--)
            for(int j = 0;10000*i+5000*j <= y;j++){
                if(10000*i+5000*j+1000*(n-i-j) == y ){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    return;
                }
            }
                
            
        System.out.println((-1)+" "+(-1)+" "+(-1));
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        
        for(int i = y/10000;i >= 0;i--)
            for(int j = 0;10000*i+5000*j <= y;j++){
                if(10000*i+5000*j+1000*(n-i-j) == y ){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    return;
                }
            }
                
            
        System.out.println((-1)+" "+(-1)+" "+(-1));
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        
        for(int i = y/10000;i >= 0;i--)
            for(int j = 0;10000*i+5000*j <= y;j++){
                if(10000*i+5000*j+1000*(n-i-j) == y ){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    return;
                }
            }
                
            
        System.out.println((-1)+" "+(-1)+" "+(-1));
    } 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 for(int i = y/10000;i >= 0;i--)
            for(int j = 0;10000*i+5000*j <= y;j++){
                if(10000*i+5000*j+1000*(n-i-j) == y ){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    return;
                }
            } int i = y/10000; int i = y/10000; i y/10000 y 10000 i >= 0 i 0 i-- i-- i for(int j = 0;10000*i+5000*j <= y;j++){
                if(10000*i+5000*j+1000*(n-i-j) == y ){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    return;
                }
            } for(int j = 0;10000*i+5000*j <= y;j++){
                if(10000*i+5000*j+1000*(n-i-j) == y ){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    return;
                }
            } int j = 0; int j = 0; j 0 10000*i+5000*j <= y 10000*i+5000*j 10000*i 10000 i 5000*j 5000 j y j++ j++ j {
                if(10000*i+5000*j+1000*(n-i-j) == y ){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    return;
                }
            } {
                if(10000*i+5000*j+1000*(n-i-j) == y ){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    return;
                }
            } if(10000*i+5000*j+1000*(n-i-j) == y ){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    return;
                } 10000*i+5000*j+1000*(n-i-j) == y 10000*i+5000*j+1000*(n-i-j) 10000*i+5000*j+1000*(n-i-j) 10000*i 10000 i 5000*j 5000 j 1000*(n-i-j) 1000 (n-i-j) n-i-j n i j y {
                    System.out.println(i+" "+j+" "+(n-i-j));
                    return;
                } System.out.println(i+" "+j+" "+(n-i-j)) System.out.println System.out System System.out i+" "+j+" "+(n-i-j) " " j i+" "+j+" "+(n-i-j) i " " j " " (n-i-j) n-i-j n i j return; System.out.println((-1)+" "+(-1)+" "+(-1)) System.out.println System.out System System.out (-1)+" "+(-1)+" "+(-1) " " (-1) (-1)+" "+(-1)+" "+(-1) (-1) 1 " " (-1) 1 " " (-1) 1 String[] args args
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        
        for(int i = y/10000;i >= 0;i--)
            for(int j = 0;10000*i+5000*j <= y;j++){
                if(10000*i+5000*j+1000*(n-i-j) == y ){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    return;
                }
            }
                
            
        System.out.println((-1)+" "+(-1)+" "+(-1));
    }
}
