import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long y = sc.nextLong();
    int ans1 = -1;
    int ans2 = -1;
    int ans3 = -1;
    for(int i = 0; i <= n; i++) {
      for(int j = 0; j <= (n - i); j++) {
        int k = n - (i + j);
        long t = (long)10000 * (long)i + (long)5000 * (long)j + (long)1000 * (long)k;
        if(t == y) {
          ans1 = i;
          ans2 = j;
          ans3 = k;
        }
      }
    }
    System.out.println(ans1 + " " + ans2 + " " + ans3);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long y = sc.nextLong();
    int ans1 = -1;
    int ans2 = -1;
    int ans3 = -1;
    for(int i = 0; i <= n; i++) {
      for(int j = 0; j <= (n - i); j++) {
        int k = n - (i + j);
        long t = (long)10000 * (long)i + (long)5000 * (long)j + (long)1000 * (long)k;
        if(t == y) {
          ans1 = i;
          ans2 = j;
          ans3 = k;
        }
      }
    }
    System.out.println(ans1 + " " + ans2 + " " + ans3);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long y = sc.nextLong();
    int ans1 = -1;
    int ans2 = -1;
    int ans3 = -1;
    for(int i = 0; i <= n; i++) {
      for(int j = 0; j <= (n - i); j++) {
        int k = n - (i + j);
        long t = (long)10000 * (long)i + (long)5000 * (long)j + (long)1000 * (long)k;
        if(t == y) {
          ans1 = i;
          ans2 = j;
          ans3 = k;
        }
      }
    }
    System.out.println(ans1 + " " + ans2 + " " + ans3);
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long y = sc.nextLong();
    int ans1 = -1;
    int ans2 = -1;
    int ans3 = -1;
    for(int i = 0; i <= n; i++) {
      for(int j = 0; j <= (n - i); j++) {
        int k = n - (i + j);
        long t = (long)10000 * (long)i + (long)5000 * (long)j + (long)1000 * (long)k;
        if(t == y) {
          ans1 = i;
          ans2 = j;
          ans3 = k;
        }
      }
    }
    System.out.println(ans1 + " " + ans2 + " " + ans3);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc long y = sc.nextLong(); y sc.nextLong() sc.nextLong sc int ans1 = -1; ans1 -1 1 int ans2 = -1; ans2 -1 1 int ans3 = -1; ans3 -1 1 for(int i = 0; i <= n; i++) {
      for(int j = 0; j <= (n - i); j++) {
        int k = n - (i + j);
        long t = (long)10000 * (long)i + (long)5000 * (long)j + (long)1000 * (long)k;
        if(t == y) {
          ans1 = i;
          ans2 = j;
          ans3 = k;
        }
      }
    } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
      for(int j = 0; j <= (n - i); j++) {
        int k = n - (i + j);
        long t = (long)10000 * (long)i + (long)5000 * (long)j + (long)1000 * (long)k;
        if(t == y) {
          ans1 = i;
          ans2 = j;
          ans3 = k;
        }
      }
    } {
      for(int j = 0; j <= (n - i); j++) {
        int k = n - (i + j);
        long t = (long)10000 * (long)i + (long)5000 * (long)j + (long)1000 * (long)k;
        if(t == y) {
          ans1 = i;
          ans2 = j;
          ans3 = k;
        }
      }
    } for(int j = 0; j <= (n - i); j++) {
        int k = n - (i + j);
        long t = (long)10000 * (long)i + (long)5000 * (long)j + (long)1000 * (long)k;
        if(t == y) {
          ans1 = i;
          ans2 = j;
          ans3 = k;
        }
      } int j = 0; int j = 0; j 0 j <= (n - i) j (n - i) n i j++ j++ j {
        int k = n - (i + j);
        long t = (long)10000 * (long)i + (long)5000 * (long)j + (long)1000 * (long)k;
        if(t == y) {
          ans1 = i;
          ans2 = j;
          ans3 = k;
        }
      } {
        int k = n - (i + j);
        long t = (long)10000 * (long)i + (long)5000 * (long)j + (long)1000 * (long)k;
        if(t == y) {
          ans1 = i;
          ans2 = j;
          ans3 = k;
        }
      } int k = n - (i + j); k n - (i + j) n (i + j) i j long t = (long)10000 * (long)i + (long)5000 * (long)j + (long)1000 * (long)k; t (long)10000 * (long)i + (long)5000 * (long)j + (long)1000 * (long)k (long)10000 * (long)i + (long)5000 * (long)j + (long)1000 * (long)k (long)10000 * (long)i (long)10000 (long)i (long)5000 * (long)j (long)5000 (long)j (long)1000 * (long)k (long)1000 (long)k if(t == y) {
          ans1 = i;
          ans2 = j;
          ans3 = k;
        } t == y t y {
          ans1 = i;
          ans2 = j;
          ans3 = k;
        } ans1 = i ans1 i ans2 = j ans2 j ans3 = k ans3 k System.out.println(ans1 + " " + ans2 + " " + ans3) System.out.println System.out System System.out ans1 + " " + ans2 + " " + ans3 " " ans2 ans1 + " " + ans2 + " " + ans3 ans1 " " ans2 " " ans3 String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long y = sc.nextLong();
    int ans1 = -1;
    int ans2 = -1;
    int ans3 = -1;
    for(int i = 0; i <= n; i++) {
      for(int j = 0; j <= (n - i); j++) {
        int k = n - (i + j);
        long t = (long)10000 * (long)i + (long)5000 * (long)j + (long)1000 * (long)k;
        if(t == y) {
          ans1 = i;
          ans2 = j;
          ans3 = k;
        }
      }
    }
    System.out.println(ans1 + " " + ans2 + " " + ans3);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long y = sc.nextLong();
    int ans1 = -1;
    int ans2 = -1;
    int ans3 = -1;
    for(int i = 0; i <= n; i++) {
      for(int j = 0; j <= (n - i); j++) {
        int k = n - (i + j);
        long t = (long)10000 * (long)i + (long)5000 * (long)j + (long)1000 * (long)k;
        if(t == y) {
          ans1 = i;
          ans2 = j;
          ans3 = k;
        }
      }
    }
    System.out.println(ans1 + " " + ans2 + " " + ans3);
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long y = sc.nextLong();
    int ans1 = -1;
    int ans2 = -1;
    int ans3 = -1;
    for(int i = 0; i <= n; i++) {
      for(int j = 0; j <= (n - i); j++) {
        int k = n - (i + j);
        long t = (long)10000 * (long)i + (long)5000 * (long)j + (long)1000 * (long)k;
        if(t == y) {
          ans1 = i;
          ans2 = j;
          ans3 = k;
        }
      }
    }
    System.out.println(ans1 + " " + ans2 + " " + ans3);
  }
}