import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int y = sc.nextInt();
    boolean bl = false;
    int f = 0;
    int s = 0;
    for(int i = 0; i <= n; i++){
      for(int j = 0; j <= n - i; j++){
        if(i * 10000 + j * 5000 + (n - i - j) * 1000 == y){
          bl = true;
          f = i;
          s = j;
          break;
        }
      }
      if(bl){
        break;
      }
    }
    if(bl){
      System.out.println("" + f + " " + s + " " + (n - f - s));
    }else{
      System.out.println("-1 -1 -1");
    }
  }
} import java.util.Scanner; Scanner java.util class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int y = sc.nextInt();
    boolean bl = false;
    int f = 0;
    int s = 0;
    for(int i = 0; i <= n; i++){
      for(int j = 0; j <= n - i; j++){
        if(i * 10000 + j * 5000 + (n - i - j) * 1000 == y){
          bl = true;
          f = i;
          s = j;
          break;
        }
      }
      if(bl){
        break;
      }
    }
    if(bl){
      System.out.println("" + f + " " + s + " " + (n - f - s));
    }else{
      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();
    boolean bl = false;
    int f = 0;
    int s = 0;
    for(int i = 0; i <= n; i++){
      for(int j = 0; j <= n - i; j++){
        if(i * 10000 + j * 5000 + (n - i - j) * 1000 == y){
          bl = true;
          f = i;
          s = j;
          break;
        }
      }
      if(bl){
        break;
      }
    }
    if(bl){
      System.out.println("" + f + " " + s + " " + (n - f - s));
    }else{
      System.out.println("-1 -1 -1");
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int y = sc.nextInt();
    boolean bl = false;
    int f = 0;
    int s = 0;
    for(int i = 0; i <= n; i++){
      for(int j = 0; j <= n - i; j++){
        if(i * 10000 + j * 5000 + (n - i - j) * 1000 == y){
          bl = true;
          f = i;
          s = j;
          break;
        }
      }
      if(bl){
        break;
      }
    }
    if(bl){
      System.out.println("" + f + " " + s + " " + (n - f - s));
    }else{
      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 boolean bl = false; bl false int f = 0; f 0 int s = 0; s 0 for(int i = 0; i <= n; i++){
      for(int j = 0; j <= n - i; j++){
        if(i * 10000 + j * 5000 + (n - i - j) * 1000 == y){
          bl = true;
          f = i;
          s = j;
          break;
        }
      }
      if(bl){
        break;
      }
    } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
      for(int j = 0; j <= n - i; j++){
        if(i * 10000 + j * 5000 + (n - i - j) * 1000 == y){
          bl = true;
          f = i;
          s = j;
          break;
        }
      }
      if(bl){
        break;
      }
    } {
      for(int j = 0; j <= n - i; j++){
        if(i * 10000 + j * 5000 + (n - i - j) * 1000 == y){
          bl = true;
          f = i;
          s = j;
          break;
        }
      }
      if(bl){
        break;
      }
    } for(int j = 0; j <= n - i; j++){
        if(i * 10000 + j * 5000 + (n - i - j) * 1000 == y){
          bl = true;
          f = i;
          s = j;
          break;
        }
      } int j = 0; int j = 0; j 0 j <= n - i j n - i n i j++ j++ j {
        if(i * 10000 + j * 5000 + (n - i - j) * 1000 == y){
          bl = true;
          f = i;
          s = j;
          break;
        }
      } {
        if(i * 10000 + j * 5000 + (n - i - j) * 1000 == y){
          bl = true;
          f = i;
          s = j;
          break;
        }
      } if(i * 10000 + j * 5000 + (n - i - j) * 1000 == y){
          bl = true;
          f = i;
          s = j;
          break;
        } 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 y {
          bl = true;
          f = i;
          s = j;
          break;
        } bl = true bl true f = i f i s = j s j break; if(bl){
        break;
      } bl {
        break;
      } break; if(bl){
      System.out.println("" + f + " " + s + " " + (n - f - s));
    }else{
      System.out.println("-1 -1 -1");
    } bl {
      System.out.println("" + f + " " + s + " " + (n - f - s));
    } System.out.println("" + f + " " + s + " " + (n - f - s)) System.out.println System.out System System.out "" + f + " " + s + " " + (n - f - s) " " s " " "" + f + " " + s + " " + (n - f - s) "" f " " s " " (n - f - s) n - f - s n f s {
      System.out.println("-1 -1 -1");
    } 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 sc = new Scanner(System.in);
    int n = sc.nextInt();
    int y = sc.nextInt();
    boolean bl = false;
    int f = 0;
    int s = 0;
    for(int i = 0; i <= n; i++){
      for(int j = 0; j <= n - i; j++){
        if(i * 10000 + j * 5000 + (n - i - j) * 1000 == y){
          bl = true;
          f = i;
          s = j;
          break;
        }
      }
      if(bl){
        break;
      }
    }
    if(bl){
      System.out.println("" + f + " " + s + " " + (n - f - s));
    }else{
      System.out.println("-1 -1 -1");
    }
  }
}