import java.util.Scanner;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int Y = sc.nextInt();
	
    int resA = -1, resB = -1, resC = -1;
	int tmpMoney = 0;
	boolean isTruth = false;
	
	for (int a=0; a<=N; a++){
	  for (int b=0; b<=N-a; b++){
	    int c = N - a - b;
	    tmpMoney = 10000*a + 5000*b + 1000*c;
	    if(tmpMoney == Y){
	      resA = a;
          resB = b;
          resC = c;
          isTruth = true;
	      break;
	    }
	  }
      if(isTruth)
        break;
	}
	
	System.out.println(resA + " " + resB + " " + resC);
  }
} import java.util.Scanner; Scanner 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 resA = -1, resB = -1, resC = -1;
	int tmpMoney = 0;
	boolean isTruth = false;
	
	for (int a=0; a<=N; a++){
	  for (int b=0; b<=N-a; b++){
	    int c = N - a - b;
	    tmpMoney = 10000*a + 5000*b + 1000*c;
	    if(tmpMoney == Y){
	      resA = a;
          resB = b;
          resC = c;
          isTruth = true;
	      break;
	    }
	  }
      if(isTruth)
        break;
	}
	
	System.out.println(resA + " " + resB + " " + resC);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int Y = sc.nextInt();
	
    int resA = -1, resB = -1, resC = -1;
	int tmpMoney = 0;
	boolean isTruth = false;
	
	for (int a=0; a<=N; a++){
	  for (int b=0; b<=N-a; b++){
	    int c = N - a - b;
	    tmpMoney = 10000*a + 5000*b + 1000*c;
	    if(tmpMoney == Y){
	      resA = a;
          resB = b;
          resC = c;
          isTruth = true;
	      break;
	    }
	  }
      if(isTruth)
        break;
	}
	
	System.out.println(resA + " " + resB + " " + resC);
  } main {
    Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int Y = sc.nextInt();
	
    int resA = -1, resB = -1, resC = -1;
	int tmpMoney = 0;
	boolean isTruth = false;
	
	for (int a=0; a<=N; a++){
	  for (int b=0; b<=N-a; b++){
	    int c = N - a - b;
	    tmpMoney = 10000*a + 5000*b + 1000*c;
	    if(tmpMoney == Y){
	      resA = a;
          resB = b;
          resC = c;
          isTruth = true;
	      break;
	    }
	  }
      if(isTruth)
        break;
	}
	
	System.out.println(resA + " " + resB + " " + resC);
  } 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 resA = -1 resA -1 1 resB = -1 resB -1 1 resC = -1; resC -1 1 int tmpMoney = 0; tmpMoney 0 boolean isTruth = false; isTruth false for (int a=0; a<=N; a++){
	  for (int b=0; b<=N-a; b++){
	    int c = N - a - b;
	    tmpMoney = 10000*a + 5000*b + 1000*c;
	    if(tmpMoney == Y){
	      resA = a;
          resB = b;
          resC = c;
          isTruth = true;
	      break;
	    }
	  }
      if(isTruth)
        break;
	} int a=0; int a=0; a 0 a<=N a N a++ a++ a {
	  for (int b=0; b<=N-a; b++){
	    int c = N - a - b;
	    tmpMoney = 10000*a + 5000*b + 1000*c;
	    if(tmpMoney == Y){
	      resA = a;
          resB = b;
          resC = c;
          isTruth = true;
	      break;
	    }
	  }
      if(isTruth)
        break;
	} {
	  for (int b=0; b<=N-a; b++){
	    int c = N - a - b;
	    tmpMoney = 10000*a + 5000*b + 1000*c;
	    if(tmpMoney == Y){
	      resA = a;
          resB = b;
          resC = c;
          isTruth = true;
	      break;
	    }
	  }
      if(isTruth)
        break;
	} for (int b=0; b<=N-a; b++){
	    int c = N - a - b;
	    tmpMoney = 10000*a + 5000*b + 1000*c;
	    if(tmpMoney == Y){
	      resA = a;
          resB = b;
          resC = c;
          isTruth = true;
	      break;
	    }
	  } int b=0; int b=0; b 0 b<=N-a b N-a N a b++ b++ b {
	    int c = N - a - b;
	    tmpMoney = 10000*a + 5000*b + 1000*c;
	    if(tmpMoney == Y){
	      resA = a;
          resB = b;
          resC = c;
          isTruth = true;
	      break;
	    }
	  } {
	    int c = N - a - b;
	    tmpMoney = 10000*a + 5000*b + 1000*c;
	    if(tmpMoney == Y){
	      resA = a;
          resB = b;
          resC = c;
          isTruth = true;
	      break;
	    }
	  } int c = N - a - b; c N - a - b N - a - b N a b tmpMoney = 10000*a + 5000*b + 1000*c tmpMoney 10000*a + 5000*b + 1000*c 10000*a + 5000*b + 1000*c 10000*a 10000 a 5000*b 5000 b 1000*c 1000 c if(tmpMoney == Y){
	      resA = a;
          resB = b;
          resC = c;
          isTruth = true;
	      break;
	    } tmpMoney == Y tmpMoney Y {
	      resA = a;
          resB = b;
          resC = c;
          isTruth = true;
	      break;
	    } resA = a resA a resB = b resB b resC = c resC c isTruth = true isTruth true break; if(isTruth)
        break; isTruth break; System.out.println(resA + " " + resB + " " + resC) System.out.println System.out System System.out resA + " " + resB + " " + resC " " resB resA + " " + resB + " " + resC resA " " resB " " resC 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 resA = -1, resB = -1, resC = -1;
	int tmpMoney = 0;
	boolean isTruth = false;
	
	for (int a=0; a<=N; a++){
	  for (int b=0; b<=N-a; b++){
	    int c = N - a - b;
	    tmpMoney = 10000*a + 5000*b + 1000*c;
	    if(tmpMoney == Y){
	      resA = a;
          resB = b;
          resC = c;
          isTruth = true;
	      break;
	    }
	  }
      if(isTruth)
        break;
	}
	
	System.out.println(resA + " " + resB + " " + resC);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int Y = sc.nextInt();
	
    int resA = -1, resB = -1, resC = -1;
	int tmpMoney = 0;
	boolean isTruth = false;
	
	for (int a=0; a<=N; a++){
	  for (int b=0; b<=N-a; b++){
	    int c = N - a - b;
	    tmpMoney = 10000*a + 5000*b + 1000*c;
	    if(tmpMoney == Y){
	      resA = a;
          resB = b;
          resC = c;
          isTruth = true;
	      break;
	    }
	  }
      if(isTruth)
        break;
	}
	
	System.out.println(resA + " " + resB + " " + resC);
  }
} Main
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int Y = sc.nextInt();
	
    int resA = -1, resB = -1, resC = -1;
	int tmpMoney = 0;
	boolean isTruth = false;
	
	for (int a=0; a<=N; a++){
	  for (int b=0; b<=N-a; b++){
	    int c = N - a - b;
	    tmpMoney = 10000*a + 5000*b + 1000*c;
	    if(tmpMoney == Y){
	      resA = a;
          resB = b;
          resC = c;
          isTruth = true;
	      break;
	    }
	  }
      if(isTruth)
        break;
	}
	
	System.out.println(resA + " " + resB + " " + resC);
  }
}