import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int y=sc.nextInt();
    for(int man=0;man<=n;man++){
      for(int gos=0;gos+man<=n;gos++){
        int sen=n-man-gos;
        if(10000*man+5000*gos+1000*sen==y){
          System.out.println(man+" "+gos+" "+sen);
          return;
        }
      }
    }
    System.out.println("-1 -1 -1");
  }
} import java.util.*; util.* java class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int y=sc.nextInt();
    for(int man=0;man<=n;man++){
      for(int gos=0;gos+man<=n;gos++){
        int sen=n-man-gos;
        if(10000*man+5000*gos+1000*sen==y){
          System.out.println(man+" "+gos+" "+sen);
          return;
        }
      }
    }
    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();
    for(int man=0;man<=n;man++){
      for(int gos=0;gos+man<=n;gos++){
        int sen=n-man-gos;
        if(10000*man+5000*gos+1000*sen==y){
          System.out.println(man+" "+gos+" "+sen);
          return;
        }
      }
    }
    System.out.println("-1 -1 -1");
  } main {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int y=sc.nextInt();
    for(int man=0;man<=n;man++){
      for(int gos=0;gos+man<=n;gos++){
        int sen=n-man-gos;
        if(10000*man+5000*gos+1000*sen==y){
          System.out.println(man+" "+gos+" "+sen);
          return;
        }
      }
    }
    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 for(int man=0;man<=n;man++){
      for(int gos=0;gos+man<=n;gos++){
        int sen=n-man-gos;
        if(10000*man+5000*gos+1000*sen==y){
          System.out.println(man+" "+gos+" "+sen);
          return;
        }
      }
    } int man=0; int man=0; man 0 man<=n man n man++ man++ man {
      for(int gos=0;gos+man<=n;gos++){
        int sen=n-man-gos;
        if(10000*man+5000*gos+1000*sen==y){
          System.out.println(man+" "+gos+" "+sen);
          return;
        }
      }
    } {
      for(int gos=0;gos+man<=n;gos++){
        int sen=n-man-gos;
        if(10000*man+5000*gos+1000*sen==y){
          System.out.println(man+" "+gos+" "+sen);
          return;
        }
      }
    } for(int gos=0;gos+man<=n;gos++){
        int sen=n-man-gos;
        if(10000*man+5000*gos+1000*sen==y){
          System.out.println(man+" "+gos+" "+sen);
          return;
        }
      } int gos=0; int gos=0; gos 0 gos+man<=n gos+man gos man n gos++ gos++ gos {
        int sen=n-man-gos;
        if(10000*man+5000*gos+1000*sen==y){
          System.out.println(man+" "+gos+" "+sen);
          return;
        }
      } {
        int sen=n-man-gos;
        if(10000*man+5000*gos+1000*sen==y){
          System.out.println(man+" "+gos+" "+sen);
          return;
        }
      } int sen=n-man-gos; sen n-man-gos n-man-gos n man gos if(10000*man+5000*gos+1000*sen==y){
          System.out.println(man+" "+gos+" "+sen);
          return;
        } 10000*man+5000*gos+1000*sen==y 10000*man+5000*gos+1000*sen 10000*man+5000*gos+1000*sen 10000*man 10000 man 5000*gos 5000 gos 1000*sen 1000 sen y {
          System.out.println(man+" "+gos+" "+sen);
          return;
        } System.out.println(man+" "+gos+" "+sen) System.out.println System.out System System.out man+" "+gos+" "+sen " " gos man+" "+gos+" "+sen man " " gos " " sen return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[] args args
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int y=sc.nextInt();
    for(int man=0;man<=n;man++){
      for(int gos=0;gos+man<=n;gos++){
        int sen=n-man-gos;
        if(10000*man+5000*gos+1000*sen==y){
          System.out.println(man+" "+gos+" "+sen);
          return;
        }
      }
    }
    System.out.println("-1 -1 -1");
  }
}