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 hukuzawa = 0;
        int higuchi = 0;
        int noguchi = 0;
      
        int i = 0;
        int j = 0;
        
        for(i = 0; i <= n ; i++){
          for(j = 0; j <= (n-i) ; j++){
            if(y == i*10000+j*5000+(n-i-j)*1000){
                    hukuzawa = i;
                    higuchi = j;
                    noguchi = n-i-j;
                    System.out.println(hukuzawa + " " + higuchi + " " + noguchi);
                    return;
              }else{
                 continue;
              }
          }
        }
      
      
       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();
        
        int hukuzawa = 0;
        int higuchi = 0;
        int noguchi = 0;
      
        int i = 0;
        int j = 0;
        
        for(i = 0; i <= n ; i++){
          for(j = 0; j <= (n-i) ; j++){
            if(y == i*10000+j*5000+(n-i-j)*1000){
                    hukuzawa = i;
                    higuchi = j;
                    noguchi = n-i-j;
                    System.out.println(hukuzawa + " " + higuchi + " " + noguchi);
                    return;
              }else{
                 continue;
              }
          }
        }
      
      
       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();
        
        int hukuzawa = 0;
        int higuchi = 0;
        int noguchi = 0;
      
        int i = 0;
        int j = 0;
        
        for(i = 0; i <= n ; i++){
          for(j = 0; j <= (n-i) ; j++){
            if(y == i*10000+j*5000+(n-i-j)*1000){
                    hukuzawa = i;
                    higuchi = j;
                    noguchi = n-i-j;
                    System.out.println(hukuzawa + " " + higuchi + " " + noguchi);
                    return;
              }else{
                 continue;
              }
          }
        }
      
      
       System.out.println(-1 + " " + -1 + " " + -1);
	} main {

		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        
        int hukuzawa = 0;
        int higuchi = 0;
        int noguchi = 0;
      
        int i = 0;
        int j = 0;
        
        for(i = 0; i <= n ; i++){
          for(j = 0; j <= (n-i) ; j++){
            if(y == i*10000+j*5000+(n-i-j)*1000){
                    hukuzawa = i;
                    higuchi = j;
                    noguchi = n-i-j;
                    System.out.println(hukuzawa + " " + higuchi + " " + noguchi);
                    return;
              }else{
                 continue;
              }
          }
        }
      
      
       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 int hukuzawa = 0; hukuzawa 0 int higuchi = 0; higuchi 0 int noguchi = 0; noguchi 0 int i = 0; i 0 int j = 0; j 0 for(i = 0; i <= n ; i++){
          for(j = 0; j <= (n-i) ; j++){
            if(y == i*10000+j*5000+(n-i-j)*1000){
                    hukuzawa = i;
                    higuchi = j;
                    noguchi = n-i-j;
                    System.out.println(hukuzawa + " " + higuchi + " " + noguchi);
                    return;
              }else{
                 continue;
              }
          }
        } i = 0; i = 0 i 0 i <= n i n i++ i++ i {
          for(j = 0; j <= (n-i) ; j++){
            if(y == i*10000+j*5000+(n-i-j)*1000){
                    hukuzawa = i;
                    higuchi = j;
                    noguchi = n-i-j;
                    System.out.println(hukuzawa + " " + higuchi + " " + noguchi);
                    return;
              }else{
                 continue;
              }
          }
        } {
          for(j = 0; j <= (n-i) ; j++){
            if(y == i*10000+j*5000+(n-i-j)*1000){
                    hukuzawa = i;
                    higuchi = j;
                    noguchi = n-i-j;
                    System.out.println(hukuzawa + " " + higuchi + " " + noguchi);
                    return;
              }else{
                 continue;
              }
          }
        } for(j = 0; j <= (n-i) ; j++){
            if(y == i*10000+j*5000+(n-i-j)*1000){
                    hukuzawa = i;
                    higuchi = j;
                    noguchi = n-i-j;
                    System.out.println(hukuzawa + " " + higuchi + " " + noguchi);
                    return;
              }else{
                 continue;
              }
          } j = 0; j = 0 j 0 j <= (n-i) j (n-i) n i j++ j++ j {
            if(y == i*10000+j*5000+(n-i-j)*1000){
                    hukuzawa = i;
                    higuchi = j;
                    noguchi = n-i-j;
                    System.out.println(hukuzawa + " " + higuchi + " " + noguchi);
                    return;
              }else{
                 continue;
              }
          } {
            if(y == i*10000+j*5000+(n-i-j)*1000){
                    hukuzawa = i;
                    higuchi = j;
                    noguchi = n-i-j;
                    System.out.println(hukuzawa + " " + higuchi + " " + noguchi);
                    return;
              }else{
                 continue;
              }
          } if(y == i*10000+j*5000+(n-i-j)*1000){
                    hukuzawa = i;
                    higuchi = j;
                    noguchi = n-i-j;
                    System.out.println(hukuzawa + " " + higuchi + " " + noguchi);
                    return;
              }else{
                 continue;
              } y == i*10000+j*5000+(n-i-j)*1000 y i*10000+j*5000+(n-i-j)*1000 i*10000+j*5000+(n-i-j)*1000 i*10000 i 10000 j*5000 j 5000 (n-i-j)*1000 (n-i-j) n-i-j n i j 1000 {
                    hukuzawa = i;
                    higuchi = j;
                    noguchi = n-i-j;
                    System.out.println(hukuzawa + " " + higuchi + " " + noguchi);
                    return;
              } hukuzawa = i hukuzawa i higuchi = j higuchi j noguchi = n-i-j noguchi n-i-j n-i-j n i j System.out.println(hukuzawa + " " + higuchi + " " + noguchi) System.out.println System.out System System.out hukuzawa + " " + higuchi + " " + noguchi " " higuchi hukuzawa + " " + higuchi + " " + noguchi hukuzawa " " higuchi " " noguchi return; {
                 continue;
              } continue; 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();
        
        int hukuzawa = 0;
        int higuchi = 0;
        int noguchi = 0;
      
        int i = 0;
        int j = 0;
        
        for(i = 0; i <= n ; i++){
          for(j = 0; j <= (n-i) ; j++){
            if(y == i*10000+j*5000+(n-i-j)*1000){
                    hukuzawa = i;
                    higuchi = j;
                    noguchi = n-i-j;
                    System.out.println(hukuzawa + " " + higuchi + " " + noguchi);
                    return;
              }else{
                 continue;
              }
          }
        }
      
      
       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();
        
        int hukuzawa = 0;
        int higuchi = 0;
        int noguchi = 0;
      
        int i = 0;
        int j = 0;
        
        for(i = 0; i <= n ; i++){
          for(j = 0; j <= (n-i) ; j++){
            if(y == i*10000+j*5000+(n-i-j)*1000){
                    hukuzawa = i;
                    higuchi = j;
                    noguchi = n-i-j;
                    System.out.println(hukuzawa + " " + higuchi + " " + noguchi);
                    return;
              }else{
                 continue;
              }
          }
        }
      
      
       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();
        
        int hukuzawa = 0;
        int higuchi = 0;
        int noguchi = 0;
      
        int i = 0;
        int j = 0;
        
        for(i = 0; i <= n ; i++){
          for(j = 0; j <= (n-i) ; j++){
            if(y == i*10000+j*5000+(n-i-j)*1000){
                    hukuzawa = i;
                    higuchi = j;
                    noguchi = n-i-j;
                    System.out.println(hukuzawa + " " + higuchi + " " + noguchi);
                    return;
              }else{
                 continue;
              }
          }
        }
      
      
       System.out.println(-1 + " " + -1 + " " + -1);
	}
}