import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);       
		int n = Integer.parseInt(sc.next());
		int y = Integer.parseInt(sc.next());
        int man = 0;
        int go = 0;
        int sen = 0;
        boolean hantei = false;
        if((double)y/10000 > n) {
            man = -1;
            go = -1;
            sen = -1;
        }else {
            for(int i=(y/10000)+1;i>=0;i--){
                if(hantei) {
                    break;
                }
                if(10000*i+1000*(n-i) > y) {
                    continue;
                }
                for(int j=n-i; j>=0; j--) {
                    int k = n-i-j;
                    long sum = 10000*i+5000*j+1000*k;
                    //System.out.println(i+" "+j+" "+k+" "+sum);
                    if(10000*i+5000*j+1000*k == y) {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    }
                }
            }
        }
        if(hantei) System.out.println(man+" "+go+" "+sen);
        else System.out.println(-1+" "+-1+" "+-1);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);       
		int n = Integer.parseInt(sc.next());
		int y = Integer.parseInt(sc.next());
        int man = 0;
        int go = 0;
        int sen = 0;
        boolean hantei = false;
        if((double)y/10000 > n) {
            man = -1;
            go = -1;
            sen = -1;
        }else {
            for(int i=(y/10000)+1;i>=0;i--){
                if(hantei) {
                    break;
                }
                if(10000*i+1000*(n-i) > y) {
                    continue;
                }
                for(int j=n-i; j>=0; j--) {
                    int k = n-i-j;
                    long sum = 10000*i+5000*j+1000*k;
                    //System.out.println(i+" "+j+" "+k+" "+sum);
                    if(10000*i+5000*j+1000*k == y) {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    }
                }
            }
        }
        if(hantei) System.out.println(man+" "+go+" "+sen);
        else System.out.println(-1+" "+-1+" "+-1);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);       
		int n = Integer.parseInt(sc.next());
		int y = Integer.parseInt(sc.next());
        int man = 0;
        int go = 0;
        int sen = 0;
        boolean hantei = false;
        if((double)y/10000 > n) {
            man = -1;
            go = -1;
            sen = -1;
        }else {
            for(int i=(y/10000)+1;i>=0;i--){
                if(hantei) {
                    break;
                }
                if(10000*i+1000*(n-i) > y) {
                    continue;
                }
                for(int j=n-i; j>=0; j--) {
                    int k = n-i-j;
                    long sum = 10000*i+5000*j+1000*k;
                    //System.out.println(i+" "+j+" "+k+" "+sum);
                    if(10000*i+5000*j+1000*k == y) {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    }
                }
            }
        }
        if(hantei) System.out.println(man+" "+go+" "+sen);
        else System.out.println(-1+" "+-1+" "+-1);
	} main {
		Scanner sc = new Scanner(System.in);       
		int n = Integer.parseInt(sc.next());
		int y = Integer.parseInt(sc.next());
        int man = 0;
        int go = 0;
        int sen = 0;
        boolean hantei = false;
        if((double)y/10000 > n) {
            man = -1;
            go = -1;
            sen = -1;
        }else {
            for(int i=(y/10000)+1;i>=0;i--){
                if(hantei) {
                    break;
                }
                if(10000*i+1000*(n-i) > y) {
                    continue;
                }
                for(int j=n-i; j>=0; j--) {
                    int k = n-i-j;
                    long sum = 10000*i+5000*j+1000*k;
                    //System.out.println(i+" "+j+" "+k+" "+sum);
                    if(10000*i+5000*j+1000*k == y) {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    }
                }
            }
        }
        if(hantei) System.out.println(man+" "+go+" "+sen);
        else System.out.println(-1+" "+-1+" "+-1);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int y = Integer.parseInt(sc.next()); y Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int man = 0; man 0 int go = 0; go 0 int sen = 0; sen 0 boolean hantei = false; hantei false if((double)y/10000 > n) {
            man = -1;
            go = -1;
            sen = -1;
        }else {
            for(int i=(y/10000)+1;i>=0;i--){
                if(hantei) {
                    break;
                }
                if(10000*i+1000*(n-i) > y) {
                    continue;
                }
                for(int j=n-i; j>=0; j--) {
                    int k = n-i-j;
                    long sum = 10000*i+5000*j+1000*k;
                    //System.out.println(i+" "+j+" "+k+" "+sum);
                    if(10000*i+5000*j+1000*k == y) {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    }
                }
            }
        } (double)y/10000 > n (double)y/10000 (double)y 10000 n {
            man = -1;
            go = -1;
            sen = -1;
        } man = -1 man -1 1 go = -1 go -1 1 sen = -1 sen -1 1 {
            for(int i=(y/10000)+1;i>=0;i--){
                if(hantei) {
                    break;
                }
                if(10000*i+1000*(n-i) > y) {
                    continue;
                }
                for(int j=n-i; j>=0; j--) {
                    int k = n-i-j;
                    long sum = 10000*i+5000*j+1000*k;
                    //System.out.println(i+" "+j+" "+k+" "+sum);
                    if(10000*i+5000*j+1000*k == y) {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    }
                }
            }
        } for(int i=(y/10000)+1;i>=0;i--){
                if(hantei) {
                    break;
                }
                if(10000*i+1000*(n-i) > y) {
                    continue;
                }
                for(int j=n-i; j>=0; j--) {
                    int k = n-i-j;
                    long sum = 10000*i+5000*j+1000*k;
                    //System.out.println(i+" "+j+" "+k+" "+sum);
                    if(10000*i+5000*j+1000*k == y) {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    }
                }
            } int i=(y/10000)+1; int i=(y/10000)+1; i (y/10000)+1 (y/10000) y 10000 1 i>=0 i 0 i-- i-- i {
                if(hantei) {
                    break;
                }
                if(10000*i+1000*(n-i) > y) {
                    continue;
                }
                for(int j=n-i; j>=0; j--) {
                    int k = n-i-j;
                    long sum = 10000*i+5000*j+1000*k;
                    //System.out.println(i+" "+j+" "+k+" "+sum);
                    if(10000*i+5000*j+1000*k == y) {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    }
                }
            } {
                if(hantei) {
                    break;
                }
                if(10000*i+1000*(n-i) > y) {
                    continue;
                }
                for(int j=n-i; j>=0; j--) {
                    int k = n-i-j;
                    long sum = 10000*i+5000*j+1000*k;
                    //System.out.println(i+" "+j+" "+k+" "+sum);
                    if(10000*i+5000*j+1000*k == y) {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    }
                }
            } if(hantei) {
                    break;
                } hantei {
                    break;
                } break; if(10000*i+1000*(n-i) > y) {
                    continue;
                } 10000*i+1000*(n-i) > y 10000*i+1000*(n-i) 10000*i 10000 i 1000*(n-i) 1000 (n-i) n i y {
                    continue;
                } continue; for(int j=n-i; j>=0; j--) {
                    int k = n-i-j;
                    long sum = 10000*i+5000*j+1000*k;
                    //System.out.println(i+" "+j+" "+k+" "+sum);
                    if(10000*i+5000*j+1000*k == y) {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    }
                } int j=n-i; int j=n-i; j n-i n i j>=0 j 0 j-- j-- j {
                    int k = n-i-j;
                    long sum = 10000*i+5000*j+1000*k;
                    //System.out.println(i+" "+j+" "+k+" "+sum);
                    if(10000*i+5000*j+1000*k == y) {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    }
                } {
                    int k = n-i-j;
                    long sum = 10000*i+5000*j+1000*k;
                    //System.out.println(i+" "+j+" "+k+" "+sum);
                    if(10000*i+5000*j+1000*k == y) {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    }
                } int k = n-i-j; k n-i-j n-i-j n i j long sum = 10000*i+5000*j+1000*k; sum 10000*i+5000*j+1000*k 10000*i+5000*j+1000*k 10000*i 10000 i 5000*j 5000 j 1000*k 1000 k if(10000*i+5000*j+1000*k == y) {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    } 10000*i+5000*j+1000*k == y 10000*i+5000*j+1000*k 10000*i+5000*j+1000*k 10000*i 10000 i 5000*j 5000 j 1000*k 1000 k y {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    } man = i man i go = j go j sen = k sen k hantei = true hantei true break; if(hantei) System.out.println(man+" "+go+" "+sen);
        else System.out.println(-1+" "+-1+" "+-1); hantei System.out.println(man+" "+go+" "+sen) System.out.println System.out System System.out man+" "+go+" "+sen " " go man+" "+go+" "+sen man " " go " " sen System.out.println(-1+" "+-1+" "+-1) System.out.println System.out System System.out -1+" "+-1+" "+-1 " " -1 -1+" "+-1+" "+-1 -1 1 " " -1 1 " " -1 1 String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);       
		int n = Integer.parseInt(sc.next());
		int y = Integer.parseInt(sc.next());
        int man = 0;
        int go = 0;
        int sen = 0;
        boolean hantei = false;
        if((double)y/10000 > n) {
            man = -1;
            go = -1;
            sen = -1;
        }else {
            for(int i=(y/10000)+1;i>=0;i--){
                if(hantei) {
                    break;
                }
                if(10000*i+1000*(n-i) > y) {
                    continue;
                }
                for(int j=n-i; j>=0; j--) {
                    int k = n-i-j;
                    long sum = 10000*i+5000*j+1000*k;
                    //System.out.println(i+" "+j+" "+k+" "+sum);
                    if(10000*i+5000*j+1000*k == y) {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    }
                }
            }
        }
        if(hantei) System.out.println(man+" "+go+" "+sen);
        else System.out.println(-1+" "+-1+" "+-1);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);       
		int n = Integer.parseInt(sc.next());
		int y = Integer.parseInt(sc.next());
        int man = 0;
        int go = 0;
        int sen = 0;
        boolean hantei = false;
        if((double)y/10000 > n) {
            man = -1;
            go = -1;
            sen = -1;
        }else {
            for(int i=(y/10000)+1;i>=0;i--){
                if(hantei) {
                    break;
                }
                if(10000*i+1000*(n-i) > y) {
                    continue;
                }
                for(int j=n-i; j>=0; j--) {
                    int k = n-i-j;
                    long sum = 10000*i+5000*j+1000*k;
                    //System.out.println(i+" "+j+" "+k+" "+sum);
                    if(10000*i+5000*j+1000*k == y) {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    }
                }
            }
        }
        if(hantei) System.out.println(man+" "+go+" "+sen);
        else System.out.println(-1+" "+-1+" "+-1);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);       
		int n = Integer.parseInt(sc.next());
		int y = Integer.parseInt(sc.next());
        int man = 0;
        int go = 0;
        int sen = 0;
        boolean hantei = false;
        if((double)y/10000 > n) {
            man = -1;
            go = -1;
            sen = -1;
        }else {
            for(int i=(y/10000)+1;i>=0;i--){
                if(hantei) {
                    break;
                }
                if(10000*i+1000*(n-i) > y) {
                    continue;
                }
                for(int j=n-i; j>=0; j--) {
                    int k = n-i-j;
                    long sum = 10000*i+5000*j+1000*k;
                    //System.out.println(i+" "+j+" "+k+" "+sum);
                    if(10000*i+5000*j+1000*k == y) {
                        man = i;
                        go = j;
                        sen = k;
                        hantei = true;
                        break;
                    }
                }
            }
        }
        if(hantei) System.out.println(man+" "+go+" "+sen);
        else System.out.println(-1+" "+-1+" "+-1);
	}
}