import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scn=new Scanner(System.in);
        int n=scn.nextInt();
        int money=scn.nextInt();
        money=money/1000;
        int answer = 0;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=n-i;j++){
                int k=n-i-j;
                if(k<0) break;
                if(money==i*10+j*5+k*1&&i+j+k==n){
                    System.out.println(i+" "+j+" "+k);
                     answer++;
                     break;
                }
            }
          	if(answer>0) break;
        }
      	if(answer==0) System.out.println("-1 -1 -1");
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
        Scanner scn=new Scanner(System.in);
        int n=scn.nextInt();
        int money=scn.nextInt();
        money=money/1000;
        int answer = 0;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=n-i;j++){
                int k=n-i-j;
                if(k<0) break;
                if(money==i*10+j*5+k*1&&i+j+k==n){
                    System.out.println(i+" "+j+" "+k);
                     answer++;
                     break;
                }
            }
          	if(answer>0) break;
        }
      	if(answer==0) System.out.println("-1 -1 -1");
    }
} Main public static void main(String[] args){
        Scanner scn=new Scanner(System.in);
        int n=scn.nextInt();
        int money=scn.nextInt();
        money=money/1000;
        int answer = 0;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=n-i;j++){
                int k=n-i-j;
                if(k<0) break;
                if(money==i*10+j*5+k*1&&i+j+k==n){
                    System.out.println(i+" "+j+" "+k);
                     answer++;
                     break;
                }
            }
          	if(answer>0) break;
        }
      	if(answer==0) System.out.println("-1 -1 -1");
    } main {
        Scanner scn=new Scanner(System.in);
        int n=scn.nextInt();
        int money=scn.nextInt();
        money=money/1000;
        int answer = 0;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=n-i;j++){
                int k=n-i-j;
                if(k<0) break;
                if(money==i*10+j*5+k*1&&i+j+k==n){
                    System.out.println(i+" "+j+" "+k);
                     answer++;
                     break;
                }
            }
          	if(answer>0) break;
        }
      	if(answer==0) System.out.println("-1 -1 -1");
    } Scanner scn=new Scanner(System.in); scn new Scanner(System.in) int n=scn.nextInt(); n scn.nextInt() scn.nextInt scn int money=scn.nextInt(); money scn.nextInt() scn.nextInt scn money=money/1000 money money/1000 money 1000 int answer = 0; answer 0 for(int i=0;i<=n;i++){
            for(int j=0;j<=n-i;j++){
                int k=n-i-j;
                if(k<0) break;
                if(money==i*10+j*5+k*1&&i+j+k==n){
                    System.out.println(i+" "+j+" "+k);
                     answer++;
                     break;
                }
            }
          	if(answer>0) 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(k<0) break;
                if(money==i*10+j*5+k*1&&i+j+k==n){
                    System.out.println(i+" "+j+" "+k);
                     answer++;
                     break;
                }
            }
          	if(answer>0) break;
        } {
            for(int j=0;j<=n-i;j++){
                int k=n-i-j;
                if(k<0) break;
                if(money==i*10+j*5+k*1&&i+j+k==n){
                    System.out.println(i+" "+j+" "+k);
                     answer++;
                     break;
                }
            }
          	if(answer>0) break;
        } for(int j=0;j<=n-i;j++){
                int k=n-i-j;
                if(k<0) break;
                if(money==i*10+j*5+k*1&&i+j+k==n){
                    System.out.println(i+" "+j+" "+k);
                     answer++;
                     break;
                }
            } 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(k<0) break;
                if(money==i*10+j*5+k*1&&i+j+k==n){
                    System.out.println(i+" "+j+" "+k);
                     answer++;
                     break;
                }
            } {
                int k=n-i-j;
                if(k<0) break;
                if(money==i*10+j*5+k*1&&i+j+k==n){
                    System.out.println(i+" "+j+" "+k);
                     answer++;
                     break;
                }
            } int k=n-i-j; k n-i-j n-i-j n i j if(k<0) break; k<0 k 0 break; if(money==i*10+j*5+k*1&&i+j+k==n){
                    System.out.println(i+" "+j+" "+k);
                     answer++;
                     break;
                } money==i*10+j*5+k*1&&i+j+k==n money==i*10+j*5+k*1 money i*10+j*5+k*1 i*10+j*5+k*1 i*10 i 10 j*5 j 5 k*1 k 1 i+j+k==n i+j+k i+j+k i j k n {
                    System.out.println(i+" "+j+" "+k);
                     answer++;
                     break;
                } System.out.println(i+" "+j+" "+k) System.out.println System.out System System.out i+" "+j+" "+k " " j i+" "+j+" "+k i " " j " " k answer++ answer break; if(answer>0) break; answer>0 answer 0 break; if(answer==0) System.out.println("-1 -1 -1"); answer==0 answer 0 System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[] args args
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scn=new Scanner(System.in);
        int n=scn.nextInt();
        int money=scn.nextInt();
        money=money/1000;
        int answer = 0;
        for(int i=0;i<=n;i++){
            for(int j=0;j<=n-i;j++){
                int k=n-i-j;
                if(k<0) break;
                if(money==i*10+j*5+k*1&&i+j+k==n){
                    System.out.println(i+" "+j+" "+k);
                     answer++;
                     break;
                }
            }
          	if(answer>0) break;
        }
      	if(answer==0) System.out.println("-1 -1 -1");
    }
}