import java.util.*;

public class Main {

    static int MOD = 1000000007;
    public static void main(String[] args) {

        int ans=0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        for(int i=0;i<n+1;i++)for(int j=0;j<n-i+1;j++){
            int k=n-i-j;
            if(y==i*10000+j*5000+1000*k){
                System.out.println(i+" "+ j+" "+k);
                return;
            }
        }

        System.out.println("-1 -1 -1");
    }

} import java.util.*; util.* java public class Main {

    static int MOD = 1000000007;
    public static void main(String[] args) {

        int ans=0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        for(int i=0;i<n+1;i++)for(int j=0;j<n-i+1;j++){
            int k=n-i-j;
            if(y==i*10000+j*5000+1000*k){
                System.out.println(i+" "+ j+" "+k);
                return;
            }
        }

        System.out.println("-1 -1 -1");
    }

} Main static int MOD = 1000000007; MOD 1000000007 public static void main(String[] args) {

        int ans=0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        for(int i=0;i<n+1;i++)for(int j=0;j<n-i+1;j++){
            int k=n-i-j;
            if(y==i*10000+j*5000+1000*k){
                System.out.println(i+" "+ j+" "+k);
                return;
            }
        }

        System.out.println("-1 -1 -1");
    } main {

        int ans=0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        for(int i=0;i<n+1;i++)for(int j=0;j<n-i+1;j++){
            int k=n-i-j;
            if(y==i*10000+j*5000+1000*k){
                System.out.println(i+" "+ j+" "+k);
                return;
            }
        }

        System.out.println("-1 -1 -1");
    } int ans=0; ans 0 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=0;i<n+1;i++)for(int j=0;j<n-i+1;j++){
            int k=n-i-j;
            if(y==i*10000+j*5000+1000*k){
                System.out.println(i+" "+ j+" "+k);
                return;
            }
        } 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-i+1;j++){
            int k=n-i-j;
            if(y==i*10000+j*5000+1000*k){
                System.out.println(i+" "+ j+" "+k);
                return;
            }
        } for(int j=0;j<n-i+1;j++){
            int k=n-i-j;
            if(y==i*10000+j*5000+1000*k){
                System.out.println(i+" "+ j+" "+k);
                return;
            }
        } int j=0; int j=0; j 0 j<n-i+1 j n-i+1 n-i n i 1 j++ j++ j {
            int k=n-i-j;
            if(y==i*10000+j*5000+1000*k){
                System.out.println(i+" "+ j+" "+k);
                return;
            }
        } {
            int k=n-i-j;
            if(y==i*10000+j*5000+1000*k){
                System.out.println(i+" "+ j+" "+k);
                return;
            }
        } int k=n-i-j; k n-i-j n-i-j n i j if(y==i*10000+j*5000+1000*k){
                System.out.println(i+" "+ j+" "+k);
                return;
            } y==i*10000+j*5000+1000*k y i*10000+j*5000+1000*k i*10000+j*5000+1000*k i*10000 i 10000 j*5000 j 5000 1000*k 1000 k {
                System.out.println(i+" "+ j+" "+k);
                return;
            } System.out.println(i+" "+ j+" "+k) System.out.println System.out System System.out i+" "+ j+" "+k " " j i+" "+ j+" "+k i " " j " " k return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[] args args public class Main {

    static int MOD = 1000000007;
    public static void main(String[] args) {

        int ans=0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        for(int i=0;i<n+1;i++)for(int j=0;j<n-i+1;j++){
            int k=n-i-j;
            if(y==i*10000+j*5000+1000*k){
                System.out.println(i+" "+ j+" "+k);
                return;
            }
        }

        System.out.println("-1 -1 -1");
    }

} public class Main {

    static int MOD = 1000000007;
    public static void main(String[] args) {

        int ans=0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        for(int i=0;i<n+1;i++)for(int j=0;j<n-i+1;j++){
            int k=n-i-j;
            if(y==i*10000+j*5000+1000*k){
                System.out.println(i+" "+ j+" "+k);
                return;
            }
        }

        System.out.println("-1 -1 -1");
    }

} Main
import java.util.*;

public class Main {

    static int MOD = 1000000007;
    public static void main(String[] args) {

        int ans=0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();

        for(int i=0;i<n+1;i++)for(int j=0;j<n-i+1;j++){
            int k=n-i-j;
            if(y==i*10000+j*5000+1000*k){
                System.out.println(i+" "+ j+" "+k);
                return;
            }
        }

        System.out.println("-1 -1 -1");
    }

}
