import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        boolean flg = true;
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N-i; j++){
                int k = N-i-j;
                if(10000*i+5000*j+1000*k == Y){
                    System.out.print(i+" ");
                    System.out.print(j+" ");
                    System.out.println(k);
                    flg = false;
                }
            }
            if(!flg){
                break;
            }
        }
        if(flg){
            System.out.println("-1 -1 -1");
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        boolean flg = true;
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N-i; j++){
                int k = N-i-j;
                if(10000*i+5000*j+1000*k == Y){
                    System.out.print(i+" ");
                    System.out.print(j+" ");
                    System.out.println(k);
                    flg = false;
                }
            }
            if(!flg){
                break;
            }
        }
        if(flg){
            System.out.println("-1 -1 -1");
        }
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        boolean flg = true;
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N-i; j++){
                int k = N-i-j;
                if(10000*i+5000*j+1000*k == Y){
                    System.out.print(i+" ");
                    System.out.print(j+" ");
                    System.out.println(k);
                    flg = false;
                }
            }
            if(!flg){
                break;
            }
        }
        if(flg){
            System.out.println("-1 -1 -1");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        boolean flg = true;
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N-i; j++){
                int k = N-i-j;
                if(10000*i+5000*j+1000*k == Y){
                    System.out.print(i+" ");
                    System.out.print(j+" ");
                    System.out.println(k);
                    flg = false;
                }
            }
            if(!flg){
                break;
            }
        }
        if(flg){
            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 boolean flg = true; flg true for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N-i; j++){
                int k = N-i-j;
                if(10000*i+5000*j+1000*k == Y){
                    System.out.print(i+" ");
                    System.out.print(j+" ");
                    System.out.println(k);
                    flg = false;
                }
            }
            if(!flg){
                break;
            }
        } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
            for(int j = 0; j <= N-i; j++){
                int k = N-i-j;
                if(10000*i+5000*j+1000*k == Y){
                    System.out.print(i+" ");
                    System.out.print(j+" ");
                    System.out.println(k);
                    flg = false;
                }
            }
            if(!flg){
                break;
            }
        } {
            for(int j = 0; j <= N-i; j++){
                int k = N-i-j;
                if(10000*i+5000*j+1000*k == Y){
                    System.out.print(i+" ");
                    System.out.print(j+" ");
                    System.out.println(k);
                    flg = false;
                }
            }
            if(!flg){
                break;
            }
        } for(int j = 0; j <= N-i; j++){
                int k = N-i-j;
                if(10000*i+5000*j+1000*k == Y){
                    System.out.print(i+" ");
                    System.out.print(j+" ");
                    System.out.println(k);
                    flg = false;
                }
            } int j = 0; int j = 0; j 0 j <= N-i j N-i N i j++ j++ j {
                int k = N-i-j;
                if(10000*i+5000*j+1000*k == Y){
                    System.out.print(i+" ");
                    System.out.print(j+" ");
                    System.out.println(k);
                    flg = false;
                }
            } {
                int k = N-i-j;
                if(10000*i+5000*j+1000*k == Y){
                    System.out.print(i+" ");
                    System.out.print(j+" ");
                    System.out.println(k);
                    flg = false;
                }
            } int k = N-i-j; k N-i-j N-i-j N i j if(10000*i+5000*j+1000*k == Y){
                    System.out.print(i+" ");
                    System.out.print(j+" ");
                    System.out.println(k);
                    flg = false;
                } 10000*i+5000*j+1000*k == Y 10000*i+5000*j+1000*k 10000*i+5000*j+1000*k 10000*i 10000 i 5000*j 5000 j 1000*k 1000 k Y {
                    System.out.print(i+" ");
                    System.out.print(j+" ");
                    System.out.println(k);
                    flg = false;
                } System.out.print(i+" ") System.out.print System.out System System.out i+" " i " " System.out.print(j+" ") System.out.print System.out System System.out j+" " j " " System.out.println(k) System.out.println System.out System System.out k flg = false flg false if(!flg){
                break;
            } !flg flg {
                break;
            } break; if(flg){
            System.out.println("-1 -1 -1");
        } flg {
            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) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        boolean flg = true;
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N-i; j++){
                int k = N-i-j;
                if(10000*i+5000*j+1000*k == Y){
                    System.out.print(i+" ");
                    System.out.print(j+" ");
                    System.out.println(k);
                    flg = false;
                }
            }
            if(!flg){
                break;
            }
        }
        if(flg){
            System.out.println("-1 -1 -1");
        }
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        boolean flg = true;
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N-i; j++){
                int k = N-i-j;
                if(10000*i+5000*j+1000*k == Y){
                    System.out.print(i+" ");
                    System.out.print(j+" ");
                    System.out.println(k);
                    flg = false;
                }
            }
            if(!flg){
                break;
            }
        }
        if(flg){
            System.out.println("-1 -1 -1");
        }
    }
} Main
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        boolean flg = true;
        for(int i = 0; i <= N; i++){
            for(int j = 0; j <= N-i; j++){
                int k = N-i-j;
                if(10000*i+5000*j+1000*k == Y){
                    System.out.print(i+" ");
                    System.out.print(j+" ");
                    System.out.println(k);
                    flg = false;
                }
            }
            if(!flg){
                break;
            }
        }
        if(flg){
            System.out.println("-1 -1 -1");
        }
    }
}