import java.util.*;
import java.util.stream.Collectors;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        int n = sc.nextInt();
        int otoshidama = sc.nextInt();

        int x = -1;
        int y = -1;
        int z = -1;

        boolean isFinish = false;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                if (n - i - j >= 0 && i + j + (n - i - j) == n) {
                    if (i * 10000 + j * 5000 + (n - i - j) * 1000 == otoshidama) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        isFinish = true;
                        break;
                    } else if(n - i - j < 0) {
                        break;
                    }
                }
            }
            if (isFinish) {
                break;

            }
        }
        System.out.println(x + " " + y + " " + z);
    }
} import java.util.*; util.* java import java.util.stream.Collectors; Collectors java.util.stream class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        int n = sc.nextInt();
        int otoshidama = sc.nextInt();

        int x = -1;
        int y = -1;
        int z = -1;

        boolean isFinish = false;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                if (n - i - j >= 0 && i + j + (n - i - j) == n) {
                    if (i * 10000 + j * 5000 + (n - i - j) * 1000 == otoshidama) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        isFinish = true;
                        break;
                    } else if(n - i - j < 0) {
                        break;
                    }
                }
            }
            if (isFinish) {
                break;

            }
        }
        System.out.println(x + " " + y + " " + z);
    }
} Main public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        int n = sc.nextInt();
        int otoshidama = sc.nextInt();

        int x = -1;
        int y = -1;
        int z = -1;

        boolean isFinish = false;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                if (n - i - j >= 0 && i + j + (n - i - j) == n) {
                    if (i * 10000 + j * 5000 + (n - i - j) * 1000 == otoshidama) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        isFinish = true;
                        break;
                    } else if(n - i - j < 0) {
                        break;
                    }
                }
            }
            if (isFinish) {
                break;

            }
        }
        System.out.println(x + " " + y + " " + z);
    } main {
        Scanner sc = new Scanner(System.in);
      
        int n = sc.nextInt();
        int otoshidama = sc.nextInt();

        int x = -1;
        int y = -1;
        int z = -1;

        boolean isFinish = false;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                if (n - i - j >= 0 && i + j + (n - i - j) == n) {
                    if (i * 10000 + j * 5000 + (n - i - j) * 1000 == otoshidama) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        isFinish = true;
                        break;
                    } else if(n - i - j < 0) {
                        break;
                    }
                }
            }
            if (isFinish) {
                break;

            }
        }
        System.out.println(x + " " + y + " " + z);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int otoshidama = sc.nextInt(); otoshidama sc.nextInt() sc.nextInt sc int x = -1; x -1 1 int y = -1; y -1 1 int z = -1; z -1 1 boolean isFinish = false; isFinish false for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                if (n - i - j >= 0 && i + j + (n - i - j) == n) {
                    if (i * 10000 + j * 5000 + (n - i - j) * 1000 == otoshidama) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        isFinish = true;
                        break;
                    } else if(n - i - j < 0) {
                        break;
                    }
                }
            }
            if (isFinish) {
                break;

            }
        } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
            for (int j = 0; j <= n; j++) {
                if (n - i - j >= 0 && i + j + (n - i - j) == n) {
                    if (i * 10000 + j * 5000 + (n - i - j) * 1000 == otoshidama) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        isFinish = true;
                        break;
                    } else if(n - i - j < 0) {
                        break;
                    }
                }
            }
            if (isFinish) {
                break;

            }
        } {
            for (int j = 0; j <= n; j++) {
                if (n - i - j >= 0 && i + j + (n - i - j) == n) {
                    if (i * 10000 + j * 5000 + (n - i - j) * 1000 == otoshidama) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        isFinish = true;
                        break;
                    } else if(n - i - j < 0) {
                        break;
                    }
                }
            }
            if (isFinish) {
                break;

            }
        } for (int j = 0; j <= n; j++) {
                if (n - i - j >= 0 && i + j + (n - i - j) == n) {
                    if (i * 10000 + j * 5000 + (n - i - j) * 1000 == otoshidama) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        isFinish = true;
                        break;
                    } else if(n - i - j < 0) {
                        break;
                    }
                }
            } int j = 0; int j = 0; j 0 j <= n j n j++ j++ j {
                if (n - i - j >= 0 && i + j + (n - i - j) == n) {
                    if (i * 10000 + j * 5000 + (n - i - j) * 1000 == otoshidama) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        isFinish = true;
                        break;
                    } else if(n - i - j < 0) {
                        break;
                    }
                }
            } {
                if (n - i - j >= 0 && i + j + (n - i - j) == n) {
                    if (i * 10000 + j * 5000 + (n - i - j) * 1000 == otoshidama) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        isFinish = true;
                        break;
                    } else if(n - i - j < 0) {
                        break;
                    }
                }
            } if (n - i - j >= 0 && i + j + (n - i - j) == n) {
                    if (i * 10000 + j * 5000 + (n - i - j) * 1000 == otoshidama) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        isFinish = true;
                        break;
                    } else if(n - i - j < 0) {
                        break;
                    }
                } n - i - j >= 0 && i + j + (n - i - j) == n n - i - j >= 0 n - i - j n - i - j n i j 0 i + j + (n - i - j) == n i + j + (n - i - j) i + j + (n - i - j) i j (n - i - j) n - i - j n i j n {
                    if (i * 10000 + j * 5000 + (n - i - j) * 1000 == otoshidama) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        isFinish = true;
                        break;
                    } else if(n - i - j < 0) {
                        break;
                    }
                } if (i * 10000 + j * 5000 + (n - i - j) * 1000 == otoshidama) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        isFinish = true;
                        break;
                    } else if(n - i - j < 0) {
                        break;
                    } i * 10000 + j * 5000 + (n - i - j) * 1000 == otoshidama 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 otoshidama {
                        x = i;
                        y = j;
                        z = n - i - j;
                        isFinish = true;
                        break;
                    } x = i x i y = j y j z = n - i - j z n - i - j n - i - j n i j isFinish = true isFinish true break; if(n - i - j < 0) {
                        break;
                    } n - i - j < 0 n - i - j n - i - j n i j 0 {
                        break;
                    } break; if (isFinish) {
                break;

            } isFinish {
                break;

            } break; System.out.println(x + " " + y + " " + z) System.out.println System.out System System.out x + " " + y + " " + z " " y x + " " + y + " " + z x " " y " " z String args[] args
import java.util.*;
import java.util.stream.Collectors;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
      
        int n = sc.nextInt();
        int otoshidama = sc.nextInt();

        int x = -1;
        int y = -1;
        int z = -1;

        boolean isFinish = false;

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                if (n - i - j >= 0 && i + j + (n - i - j) == n) {
                    if (i * 10000 + j * 5000 + (n - i - j) * 1000 == otoshidama) {
                        x = i;
                        y = j;
                        z = n - i - j;
                        isFinish = true;
                        break;
                    } else if(n - i - j < 0) {
                        break;
                    }
                }
            }
            if (isFinish) {
                break;

            }
        }
        System.out.println(x + " " + y + " " + z);
    }
}