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();
        sc.close();

        loop: for(int i = 0; i  <= 2000; i++){
            for(int j = 0; j <= 2000-i; j++){
                int k = N - i - j;
                if(k < 0)
                    continue loop;
                if(10000*i + 5000*j + 1000*k == Y){
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
} 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();
        sc.close();

        loop: for(int i = 0; i  <= 2000; i++){
            for(int j = 0; j <= 2000-i; j++){
                int k = N - i - j;
                if(k < 0)
                    continue loop;
                if(10000*i + 5000*j + 1000*k == Y){
                    System.out.println(i + " " + j + " " + k);
                    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();
        sc.close();

        loop: for(int i = 0; i  <= 2000; i++){
            for(int j = 0; j <= 2000-i; j++){
                int k = N - i - j;
                if(k < 0)
                    continue loop;
                if(10000*i + 5000*j + 1000*k == Y){
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    } main {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        sc.close();

        loop: for(int i = 0; i  <= 2000; i++){
            for(int j = 0; j <= 2000-i; j++){
                int k = N - i - j;
                if(k < 0)
                    continue loop;
                if(10000*i + 5000*j + 1000*k == Y){
                    System.out.println(i + " " + j + " " + k);
                    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 sc.close() sc.close sc 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 sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        sc.close();

        loop: for(int i = 0; i  <= 2000; i++){
            for(int j = 0; j <= 2000-i; j++){
                int k = N - i - j;
                if(k < 0)
                    continue loop;
                if(10000*i + 5000*j + 1000*k == Y){
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
} public class Main{

    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int Y = sc.nextInt();
        sc.close();

        loop: for(int i = 0; i  <= 2000; i++){
            for(int j = 0; j <= 2000-i; j++){
                int k = N - i - j;
                if(k < 0)
                    continue loop;
                if(10000*i + 5000*j + 1000*k == Y){
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
} 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();
        sc.close();

        loop: for(int i = 0; i  <= 2000; i++){
            for(int j = 0; j <= 2000-i; j++){
                int k = N - i - j;
                if(k < 0)
                    continue loop;
                if(10000*i + 5000*j + 1000*k == Y){
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
}