import java.util.Scanner;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a, b, c;
    a = b = c = -1;
    int n = sc.nextInt();
    int y = sc.nextInt();
    for (int i = 0; i <= n; i++) {
      for (int j = 0; j <= (n - i); j++) {
        int tmpA = i;
        int tmpB = j;
        int tmpC = n - i - j;
        if (10000 * tmpA + 5000 * tmpB + 1000 * tmpC == y) {
          a = tmpA;
          b = tmpB;
          c = tmpC;
        }
      }
    }

    System.out.println(a + " " + b + " " + c);
    sc.close();
  }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a, b, c;
    a = b = c = -1;
    int n = sc.nextInt();
    int y = sc.nextInt();
    for (int i = 0; i <= n; i++) {
      for (int j = 0; j <= (n - i); j++) {
        int tmpA = i;
        int tmpB = j;
        int tmpC = n - i - j;
        if (10000 * tmpA + 5000 * tmpB + 1000 * tmpC == y) {
          a = tmpA;
          b = tmpB;
          c = tmpC;
        }
      }
    }

    System.out.println(a + " " + b + " " + c);
    sc.close();
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a, b, c;
    a = b = c = -1;
    int n = sc.nextInt();
    int y = sc.nextInt();
    for (int i = 0; i <= n; i++) {
      for (int j = 0; j <= (n - i); j++) {
        int tmpA = i;
        int tmpB = j;
        int tmpC = n - i - j;
        if (10000 * tmpA + 5000 * tmpB + 1000 * tmpC == y) {
          a = tmpA;
          b = tmpB;
          c = tmpC;
        }
      }
    }

    System.out.println(a + " " + b + " " + c);
    sc.close();
  } main {
    Scanner sc = new Scanner(System.in);
    int a, b, c;
    a = b = c = -1;
    int n = sc.nextInt();
    int y = sc.nextInt();
    for (int i = 0; i <= n; i++) {
      for (int j = 0; j <= (n - i); j++) {
        int tmpA = i;
        int tmpB = j;
        int tmpC = n - i - j;
        if (10000 * tmpA + 5000 * tmpB + 1000 * tmpC == y) {
          a = tmpA;
          b = tmpB;
          c = tmpC;
        }
      }
    }

    System.out.println(a + " " + b + " " + c);
    sc.close();
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a a b b c; c a = b = c = -1 a b = c = -1 b c = -1 c -1 1 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++) {
      for (int j = 0; j <= (n - i); j++) {
        int tmpA = i;
        int tmpB = j;
        int tmpC = n - i - j;
        if (10000 * tmpA + 5000 * tmpB + 1000 * tmpC == y) {
          a = tmpA;
          b = tmpB;
          c = tmpC;
        }
      }
    } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
      for (int j = 0; j <= (n - i); j++) {
        int tmpA = i;
        int tmpB = j;
        int tmpC = n - i - j;
        if (10000 * tmpA + 5000 * tmpB + 1000 * tmpC == y) {
          a = tmpA;
          b = tmpB;
          c = tmpC;
        }
      }
    } {
      for (int j = 0; j <= (n - i); j++) {
        int tmpA = i;
        int tmpB = j;
        int tmpC = n - i - j;
        if (10000 * tmpA + 5000 * tmpB + 1000 * tmpC == y) {
          a = tmpA;
          b = tmpB;
          c = tmpC;
        }
      }
    } for (int j = 0; j <= (n - i); j++) {
        int tmpA = i;
        int tmpB = j;
        int tmpC = n - i - j;
        if (10000 * tmpA + 5000 * tmpB + 1000 * tmpC == y) {
          a = tmpA;
          b = tmpB;
          c = tmpC;
        }
      } int j = 0; int j = 0; j 0 j <= (n - i) j (n - i) n i j++ j++ j {
        int tmpA = i;
        int tmpB = j;
        int tmpC = n - i - j;
        if (10000 * tmpA + 5000 * tmpB + 1000 * tmpC == y) {
          a = tmpA;
          b = tmpB;
          c = tmpC;
        }
      } {
        int tmpA = i;
        int tmpB = j;
        int tmpC = n - i - j;
        if (10000 * tmpA + 5000 * tmpB + 1000 * tmpC == y) {
          a = tmpA;
          b = tmpB;
          c = tmpC;
        }
      } int tmpA = i; tmpA i int tmpB = j; tmpB j int tmpC = n - i - j; tmpC n - i - j n - i - j n i j if (10000 * tmpA + 5000 * tmpB + 1000 * tmpC == y) {
          a = tmpA;
          b = tmpB;
          c = tmpC;
        } 10000 * tmpA + 5000 * tmpB + 1000 * tmpC == y 10000 * tmpA + 5000 * tmpB + 1000 * tmpC 10000 * tmpA + 5000 * tmpB + 1000 * tmpC 10000 * tmpA 10000 tmpA 5000 * tmpB 5000 tmpB 1000 * tmpC 1000 tmpC y {
          a = tmpA;
          b = tmpB;
          c = tmpC;
        } a = tmpA a tmpA b = tmpB b tmpB c = tmpC c tmpC System.out.println(a + " " + b + " " + c) System.out.println System.out System System.out a + " " + b + " " + c " " b a + " " + b + " " + c a " " b " " c sc.close() sc.close sc String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a, b, c;
    a = b = c = -1;
    int n = sc.nextInt();
    int y = sc.nextInt();
    for (int i = 0; i <= n; i++) {
      for (int j = 0; j <= (n - i); j++) {
        int tmpA = i;
        int tmpB = j;
        int tmpC = n - i - j;
        if (10000 * tmpA + 5000 * tmpB + 1000 * tmpC == y) {
          a = tmpA;
          b = tmpB;
          c = tmpC;
        }
      }
    }

    System.out.println(a + " " + b + " " + c);
    sc.close();
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a, b, c;
    a = b = c = -1;
    int n = sc.nextInt();
    int y = sc.nextInt();
    for (int i = 0; i <= n; i++) {
      for (int j = 0; j <= (n - i); j++) {
        int tmpA = i;
        int tmpB = j;
        int tmpC = n - i - j;
        if (10000 * tmpA + 5000 * tmpB + 1000 * tmpC == y) {
          a = tmpA;
          b = tmpB;
          c = tmpC;
        }
      }
    }

    System.out.println(a + " " + b + " " + c);
    sc.close();
  }
} Main
import java.util.Scanner;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a, b, c;
    a = b = c = -1;
    int n = sc.nextInt();
    int y = sc.nextInt();
    for (int i = 0; i <= n; i++) {
      for (int j = 0; j <= (n - i); j++) {
        int tmpA = i;
        int tmpB = j;
        int tmpC = n - i - j;
        if (10000 * tmpA + 5000 * tmpB + 1000 * tmpC == y) {
          a = tmpA;
          b = tmpB;
          c = tmpC;
        }
      }
    }

    System.out.println(a + " " + b + " " + c);
    sc.close();
  }
}