import java.io.*;
import java.util.ArrayList;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        String[] sl = str.split(" ");
        int N = Integer.parseInt(sl[0]);
        int Y = Integer.parseInt(sl[1]);
        int[] ans = {-1,-1,-1};
        for (int i=N;i>=0;i--){
            for (int j=N-i;j>=0;j--){
                for (int k=N-i-j;k>=0;k--){
                    if (i+j+k!=N){
                        continue;
                    }
                    if (i*10000+j*5000+k*1000==Y){
                        ans[0] = i;
                        ans[1] = j;
                        ans[2] = k;
                    }
                }
            }
        }
        for (int i=0;i<3;i++){
            System.out.println(ans[i]);
        }
    }
} import java.io.*; io.* java import java.util.ArrayList; ArrayList java.util class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        String[] sl = str.split(" ");
        int N = Integer.parseInt(sl[0]);
        int Y = Integer.parseInt(sl[1]);
        int[] ans = {-1,-1,-1};
        for (int i=N;i>=0;i--){
            for (int j=N-i;j>=0;j--){
                for (int k=N-i-j;k>=0;k--){
                    if (i+j+k!=N){
                        continue;
                    }
                    if (i*10000+j*5000+k*1000==Y){
                        ans[0] = i;
                        ans[1] = j;
                        ans[2] = k;
                    }
                }
            }
        }
        for (int i=0;i<3;i++){
            System.out.println(ans[i]);
        }
    }
} Main public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        String[] sl = str.split(" ");
        int N = Integer.parseInt(sl[0]);
        int Y = Integer.parseInt(sl[1]);
        int[] ans = {-1,-1,-1};
        for (int i=N;i>=0;i--){
            for (int j=N-i;j>=0;j--){
                for (int k=N-i-j;k>=0;k--){
                    if (i+j+k!=N){
                        continue;
                    }
                    if (i*10000+j*5000+k*1000==Y){
                        ans[0] = i;
                        ans[1] = j;
                        ans[2] = k;
                    }
                }
            }
        }
        for (int i=0;i<3;i++){
            System.out.println(ans[i]);
        }
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        String[] sl = str.split(" ");
        int N = Integer.parseInt(sl[0]);
        int Y = Integer.parseInt(sl[1]);
        int[] ans = {-1,-1,-1};
        for (int i=N;i>=0;i--){
            for (int j=N-i;j>=0;j--){
                for (int k=N-i-j;k>=0;k--){
                    if (i+j+k!=N){
                        continue;
                    }
                    if (i*10000+j*5000+k*1000==Y){
                        ans[0] = i;
                        ans[1] = j;
                        ans[2] = k;
                    }
                }
            }
        }
        for (int i=0;i<3;i++){
            System.out.println(ans[i]);
        }
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str = br.readLine(); str br.readLine() br.readLine br String[] sl = str.split(" "); sl str.split(" ") str.split str " " int N = Integer.parseInt(sl[0]); N Integer.parseInt(sl[0]) Integer.parseInt Integer sl[0] sl 0 int Y = Integer.parseInt(sl[1]); Y Integer.parseInt(sl[1]) Integer.parseInt Integer sl[1] sl 1 int[] ans = {-1,-1,-1}; ans {-1,-1,-1} -1 1 -1 1 -1 1 for (int i=N;i>=0;i--){
            for (int j=N-i;j>=0;j--){
                for (int k=N-i-j;k>=0;k--){
                    if (i+j+k!=N){
                        continue;
                    }
                    if (i*10000+j*5000+k*1000==Y){
                        ans[0] = i;
                        ans[1] = j;
                        ans[2] = k;
                    }
                }
            }
        } int i=N; int i=N; i N i>=0 i 0 i-- i-- i {
            for (int j=N-i;j>=0;j--){
                for (int k=N-i-j;k>=0;k--){
                    if (i+j+k!=N){
                        continue;
                    }
                    if (i*10000+j*5000+k*1000==Y){
                        ans[0] = i;
                        ans[1] = j;
                        ans[2] = k;
                    }
                }
            }
        } {
            for (int j=N-i;j>=0;j--){
                for (int k=N-i-j;k>=0;k--){
                    if (i+j+k!=N){
                        continue;
                    }
                    if (i*10000+j*5000+k*1000==Y){
                        ans[0] = i;
                        ans[1] = j;
                        ans[2] = k;
                    }
                }
            }
        } for (int j=N-i;j>=0;j--){
                for (int k=N-i-j;k>=0;k--){
                    if (i+j+k!=N){
                        continue;
                    }
                    if (i*10000+j*5000+k*1000==Y){
                        ans[0] = i;
                        ans[1] = j;
                        ans[2] = k;
                    }
                }
            } int j=N-i; int j=N-i; j N-i N i j>=0 j 0 j-- j-- j {
                for (int k=N-i-j;k>=0;k--){
                    if (i+j+k!=N){
                        continue;
                    }
                    if (i*10000+j*5000+k*1000==Y){
                        ans[0] = i;
                        ans[1] = j;
                        ans[2] = k;
                    }
                }
            } {
                for (int k=N-i-j;k>=0;k--){
                    if (i+j+k!=N){
                        continue;
                    }
                    if (i*10000+j*5000+k*1000==Y){
                        ans[0] = i;
                        ans[1] = j;
                        ans[2] = k;
                    }
                }
            } for (int k=N-i-j;k>=0;k--){
                    if (i+j+k!=N){
                        continue;
                    }
                    if (i*10000+j*5000+k*1000==Y){
                        ans[0] = i;
                        ans[1] = j;
                        ans[2] = k;
                    }
                } int k=N-i-j; int k=N-i-j; k N-i-j N-i-j N i j k>=0 k 0 k-- k-- k {
                    if (i+j+k!=N){
                        continue;
                    }
                    if (i*10000+j*5000+k*1000==Y){
                        ans[0] = i;
                        ans[1] = j;
                        ans[2] = k;
                    }
                } {
                    if (i+j+k!=N){
                        continue;
                    }
                    if (i*10000+j*5000+k*1000==Y){
                        ans[0] = i;
                        ans[1] = j;
                        ans[2] = k;
                    }
                } if (i+j+k!=N){
                        continue;
                    } i+j+k!=N i+j+k i+j+k i j k N {
                        continue;
                    } continue; if (i*10000+j*5000+k*1000==Y){
                        ans[0] = i;
                        ans[1] = j;
                        ans[2] = k;
                    } i*10000+j*5000+k*1000==Y i*10000+j*5000+k*1000 i*10000+j*5000+k*1000 i*10000 i 10000 j*5000 j 5000 k*1000 k 1000 Y {
                        ans[0] = i;
                        ans[1] = j;
                        ans[2] = k;
                    } ans[0] = i ans[0] ans 0 i ans[1] = j ans[1] ans 1 j ans[2] = k ans[2] ans 2 k for (int i=0;i<3;i++){
            System.out.println(ans[i]);
        } int i=0; int i=0; i 0 i<3 i 3 i++ i++ i {
            System.out.println(ans[i]);
        } {
            System.out.println(ans[i]);
        } System.out.println(ans[i]) System.out.println System.out System System.out ans[i] ans i String[] args args
import java.io.*;
import java.util.ArrayList;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        String[] sl = str.split(" ");
        int N = Integer.parseInt(sl[0]);
        int Y = Integer.parseInt(sl[1]);
        int[] ans = {-1,-1,-1};
        for (int i=N;i>=0;i--){
            for (int j=N-i;j>=0;j--){
                for (int k=N-i-j;k>=0;k--){
                    if (i+j+k!=N){
                        continue;
                    }
                    if (i*10000+j*5000+k*1000==Y){
                        ans[0] = i;
                        ans[1] = j;
                        ans[2] = k;
                    }
                }
            }
        }
        for (int i=0;i<3;i++){
            System.out.println(ans[i]);
        }
    }
}