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();
        int a = -1;
        int b = -1;
        int c = -1;
        int flag = 0;
      
	    for(int i=0; i<=N; i++){
          for(int j=0; i+j<=N; j++){
            int k = N-i-j;
            int M = 10000*i + 5000*j + 1000*k;
            if(M == Y){
              a = i;
              b = j;
              c = k;
              flag = 1;
              break;
            }
            if(flag == 1){
              break;
            }
          }
        }
		System.out.println(a+" "+b+" "+c);
    }
} 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();
        int a = -1;
        int b = -1;
        int c = -1;
        int flag = 0;
      
	    for(int i=0; i<=N; i++){
          for(int j=0; i+j<=N; j++){
            int k = N-i-j;
            int M = 10000*i + 5000*j + 1000*k;
            if(M == Y){
              a = i;
              b = j;
              c = k;
              flag = 1;
              break;
            }
            if(flag == 1){
              break;
            }
          }
        }
		System.out.println(a+" "+b+" "+c);
    }
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
        int Y = sc.nextInt();
        int a = -1;
        int b = -1;
        int c = -1;
        int flag = 0;
      
	    for(int i=0; i<=N; i++){
          for(int j=0; i+j<=N; j++){
            int k = N-i-j;
            int M = 10000*i + 5000*j + 1000*k;
            if(M == Y){
              a = i;
              b = j;
              c = k;
              flag = 1;
              break;
            }
            if(flag == 1){
              break;
            }
          }
        }
		System.out.println(a+" "+b+" "+c);
    } main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
        int Y = sc.nextInt();
        int a = -1;
        int b = -1;
        int c = -1;
        int flag = 0;
      
	    for(int i=0; i<=N; i++){
          for(int j=0; i+j<=N; j++){
            int k = N-i-j;
            int M = 10000*i + 5000*j + 1000*k;
            if(M == Y){
              a = i;
              b = j;
              c = k;
              flag = 1;
              break;
            }
            if(flag == 1){
              break;
            }
          }
        }
		System.out.println(a+" "+b+" "+c);
    } 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 int a = -1; a -1 1 int b = -1; b -1 1 int c = -1; c -1 1 int flag = 0; flag 0 for(int i=0; i<=N; i++){
          for(int j=0; i+j<=N; j++){
            int k = N-i-j;
            int M = 10000*i + 5000*j + 1000*k;
            if(M == Y){
              a = i;
              b = j;
              c = k;
              flag = 1;
              break;
            }
            if(flag == 1){
              break;
            }
          }
        } int i=0; int i=0; i 0 i<=N i N i++ i++ i {
          for(int j=0; i+j<=N; j++){
            int k = N-i-j;
            int M = 10000*i + 5000*j + 1000*k;
            if(M == Y){
              a = i;
              b = j;
              c = k;
              flag = 1;
              break;
            }
            if(flag == 1){
              break;
            }
          }
        } {
          for(int j=0; i+j<=N; j++){
            int k = N-i-j;
            int M = 10000*i + 5000*j + 1000*k;
            if(M == Y){
              a = i;
              b = j;
              c = k;
              flag = 1;
              break;
            }
            if(flag == 1){
              break;
            }
          }
        } for(int j=0; i+j<=N; j++){
            int k = N-i-j;
            int M = 10000*i + 5000*j + 1000*k;
            if(M == Y){
              a = i;
              b = j;
              c = k;
              flag = 1;
              break;
            }
            if(flag == 1){
              break;
            }
          } int j=0; int j=0; j 0 i+j<=N i+j i j N j++ j++ j {
            int k = N-i-j;
            int M = 10000*i + 5000*j + 1000*k;
            if(M == Y){
              a = i;
              b = j;
              c = k;
              flag = 1;
              break;
            }
            if(flag == 1){
              break;
            }
          } {
            int k = N-i-j;
            int M = 10000*i + 5000*j + 1000*k;
            if(M == Y){
              a = i;
              b = j;
              c = k;
              flag = 1;
              break;
            }
            if(flag == 1){
              break;
            }
          } int k = N-i-j; k N-i-j N-i-j N i j int M = 10000*i + 5000*j + 1000*k; M 10000*i + 5000*j + 1000*k 10000*i + 5000*j + 1000*k 10000*i 10000 i 5000*j 5000 j 1000*k 1000 k if(M == Y){
              a = i;
              b = j;
              c = k;
              flag = 1;
              break;
            } M == Y M Y {
              a = i;
              b = j;
              c = k;
              flag = 1;
              break;
            } a = i a i b = j b j c = k c k flag = 1 flag 1 break; if(flag == 1){
              break;
            } flag == 1 flag 1 {
              break;
            } break; System.out.println(a+" "+b+" "+c) System.out.println System.out System System.out a+" "+b+" "+c " " b a+" "+b+" "+c a " " b " " c 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();
        int a = -1;
        int b = -1;
        int c = -1;
        int flag = 0;
      
	    for(int i=0; i<=N; i++){
          for(int j=0; i+j<=N; j++){
            int k = N-i-j;
            int M = 10000*i + 5000*j + 1000*k;
            if(M == Y){
              a = i;
              b = j;
              c = k;
              flag = 1;
              break;
            }
            if(flag == 1){
              break;
            }
          }
        }
		System.out.println(a+" "+b+" "+c);
    }
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
        int Y = sc.nextInt();
        int a = -1;
        int b = -1;
        int c = -1;
        int flag = 0;
      
	    for(int i=0; i<=N; i++){
          for(int j=0; i+j<=N; j++){
            int k = N-i-j;
            int M = 10000*i + 5000*j + 1000*k;
            if(M == Y){
              a = i;
              b = j;
              c = k;
              flag = 1;
              break;
            }
            if(flag == 1){
              break;
            }
          }
        }
		System.out.println(a+" "+b+" "+c);
    }
} 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();
        int a = -1;
        int b = -1;
        int c = -1;
        int flag = 0;
      
	    for(int i=0; i<=N; i++){
          for(int j=0; i+j<=N; j++){
            int k = N-i-j;
            int M = 10000*i + 5000*j + 1000*k;
            if(M == Y){
              a = i;
              b = j;
              c = k;
              flag = 1;
              break;
            }
            if(flag == 1){
              break;
            }
          }
        }
		System.out.println(a+" "+b+" "+c);
    }
}
