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 i = 0; i <= N; i++) {
      int x = i*10000;
      if (x > Y) break;
      for (int j = 0; j <= N - i; j++) {
        int y = j * 5000;
        if ((x + y) > Y) break;
        if ((Y - x - y) / 1000 == (N - i - j)) {
          System.out.println(i + " " + j + " " + (Y - x - y) / 1000 );
          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 i = 0; i <= N; i++) {
      int x = i*10000;
      if (x > Y) break;
      for (int j = 0; j <= N - i; j++) {
        int y = j * 5000;
        if ((x + y) > Y) break;
        if ((Y - x - y) / 1000 == (N - i - j)) {
          System.out.println(i + " " + j + " " + (Y - x - y) / 1000 );
          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 i = 0; i <= N; i++) {
      int x = i*10000;
      if (x > Y) break;
      for (int j = 0; j <= N - i; j++) {
        int y = j * 5000;
        if ((x + y) > Y) break;
        if ((Y - x - y) / 1000 == (N - i - j)) {
          System.out.println(i + " " + j + " " + (Y - x - y) / 1000 );
          return; 
        }
      }
    }
    System.out.println("-1 -1 -1");
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Y = sc.nextInt();
    
    for (int i = 0; i <= N; i++) {
      int x = i*10000;
      if (x > Y) break;
      for (int j = 0; j <= N - i; j++) {
        int y = j * 5000;
        if ((x + y) > Y) break;
        if ((Y - x - y) / 1000 == (N - i - j)) {
          System.out.println(i + " " + j + " " + (Y - x - y) / 1000 );
          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 i = 0; i <= N; i++) {
      int x = i*10000;
      if (x > Y) break;
      for (int j = 0; j <= N - i; j++) {
        int y = j * 5000;
        if ((x + y) > Y) break;
        if ((Y - x - y) / 1000 == (N - i - j)) {
          System.out.println(i + " " + j + " " + (Y - x - y) / 1000 );
          return; 
        }
      }
    } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {
      int x = i*10000;
      if (x > Y) break;
      for (int j = 0; j <= N - i; j++) {
        int y = j * 5000;
        if ((x + y) > Y) break;
        if ((Y - x - y) / 1000 == (N - i - j)) {
          System.out.println(i + " " + j + " " + (Y - x - y) / 1000 );
          return; 
        }
      }
    } {
      int x = i*10000;
      if (x > Y) break;
      for (int j = 0; j <= N - i; j++) {
        int y = j * 5000;
        if ((x + y) > Y) break;
        if ((Y - x - y) / 1000 == (N - i - j)) {
          System.out.println(i + " " + j + " " + (Y - x - y) / 1000 );
          return; 
        }
      }
    } int x = i*10000; x i*10000 i 10000 if (x > Y) break; x > Y x Y break; for (int j = 0; j <= N - i; j++) {
        int y = j * 5000;
        if ((x + y) > Y) break;
        if ((Y - x - y) / 1000 == (N - i - j)) {
          System.out.println(i + " " + j + " " + (Y - x - y) / 1000 );
          return; 
        }
      } int j = 0; int j = 0; j 0 j <= N - i j N - i N i j++ j++ j {
        int y = j * 5000;
        if ((x + y) > Y) break;
        if ((Y - x - y) / 1000 == (N - i - j)) {
          System.out.println(i + " " + j + " " + (Y - x - y) / 1000 );
          return; 
        }
      } {
        int y = j * 5000;
        if ((x + y) > Y) break;
        if ((Y - x - y) / 1000 == (N - i - j)) {
          System.out.println(i + " " + j + " " + (Y - x - y) / 1000 );
          return; 
        }
      } int y = j * 5000; y j * 5000 j 5000 if ((x + y) > Y) break; (x + y) > Y (x + y) x y Y break; if ((Y - x - y) / 1000 == (N - i - j)) {
          System.out.println(i + " " + j + " " + (Y - x - y) / 1000 );
          return; 
        } (Y - x - y) / 1000 == (N - i - j) (Y - x - y) / 1000 (Y - x - y) Y - x - y Y x y 1000 (N - i - j) N - i - j N i j {
          System.out.println(i + " " + j + " " + (Y - x - y) / 1000 );
          return; 
        } System.out.println(i + " " + j + " " + (Y - x - y) / 1000 ) System.out.println System.out System System.out i + " " + j + " " + (Y - x - y) / 1000 " " j i + " " + j + " " + (Y - x - y) / 1000 i " " j " " (Y - x - y) / 1000 (Y - x - y) Y - x - y Y x y 1000 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 i = 0; i <= N; i++) {
      int x = i*10000;
      if (x > Y) break;
      for (int j = 0; j <= N - i; j++) {
        int y = j * 5000;
        if ((x + y) > Y) break;
        if ((Y - x - y) / 1000 == (N - i - j)) {
          System.out.println(i + " " + j + " " + (Y - x - y) / 1000 );
          return; 
        }
      }
    }
    System.out.println("-1 -1 -1");
  }
}
  