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