import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
       
        int n = scan.nextInt();
        int s = scan.nextInt();

        int x = -1, y = -1, z = -1;
        boolean flg = false;
        for(int i=0; i<=n; i++){
            for(int j=0; j<=n-i; j++){
                int k = n - (i + j);
                if((i+j+k) != n || (10000*i + 5000*j + 1000*k) != s) continue;
                else{
                    x = i;
                    y = j;
                    z = k;
                    flg = true;
                    break;
                }
            }
            if(flg) break;
        }

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

        scan.close();
        
    }
} import java.util.Scanner; Scanner java.util public class Main{

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
       
        int n = scan.nextInt();
        int s = scan.nextInt();

        int x = -1, y = -1, z = -1;
        boolean flg = false;
        for(int i=0; i<=n; i++){
            for(int j=0; j<=n-i; j++){
                int k = n - (i + j);
                if((i+j+k) != n || (10000*i + 5000*j + 1000*k) != s) continue;
                else{
                    x = i;
                    y = j;
                    z = k;
                    flg = true;
                    break;
                }
            }
            if(flg) break;
        }

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

        scan.close();
        
    }
} Main public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
       
        int n = scan.nextInt();
        int s = scan.nextInt();

        int x = -1, y = -1, z = -1;
        boolean flg = false;
        for(int i=0; i<=n; i++){
            for(int j=0; j<=n-i; j++){
                int k = n - (i + j);
                if((i+j+k) != n || (10000*i + 5000*j + 1000*k) != s) continue;
                else{
                    x = i;
                    y = j;
                    z = k;
                    flg = true;
                    break;
                }
            }
            if(flg) break;
        }

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

        scan.close();
        
    } main {
        
        Scanner scan = new Scanner(System.in);
       
        int n = scan.nextInt();
        int s = scan.nextInt();

        int x = -1, y = -1, z = -1;
        boolean flg = false;
        for(int i=0; i<=n; i++){
            for(int j=0; j<=n-i; j++){
                int k = n - (i + j);
                if((i+j+k) != n || (10000*i + 5000*j + 1000*k) != s) continue;
                else{
                    x = i;
                    y = j;
                    z = k;
                    flg = true;
                    break;
                }
            }
            if(flg) break;
        }

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

        scan.close();
        
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int s = scan.nextInt(); s scan.nextInt() scan.nextInt scan int x = -1 x -1 1 y = -1 y -1 1 z = -1; z -1 1 boolean flg = false; flg false for(int i=0; i<=n; i++){
            for(int j=0; j<=n-i; j++){
                int k = n - (i + j);
                if((i+j+k) != n || (10000*i + 5000*j + 1000*k) != s) continue;
                else{
                    x = i;
                    y = j;
                    z = k;
                    flg = true;
                    break;
                }
            }
            if(flg) break;
        } 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);
                if((i+j+k) != n || (10000*i + 5000*j + 1000*k) != s) continue;
                else{
                    x = i;
                    y = j;
                    z = k;
                    flg = true;
                    break;
                }
            }
            if(flg) break;
        } {
            for(int j=0; j<=n-i; j++){
                int k = n - (i + j);
                if((i+j+k) != n || (10000*i + 5000*j + 1000*k) != s) continue;
                else{
                    x = i;
                    y = j;
                    z = k;
                    flg = true;
                    break;
                }
            }
            if(flg) break;
        } for(int j=0; j<=n-i; j++){
                int k = n - (i + j);
                if((i+j+k) != n || (10000*i + 5000*j + 1000*k) != s) continue;
                else{
                    x = i;
                    y = j;
                    z = k;
                    flg = true;
                    break;
                }
            } int j=0; int j=0; j 0 j<=n-i j n-i n i j++ j++ j {
                int k = n - (i + j);
                if((i+j+k) != n || (10000*i + 5000*j + 1000*k) != s) continue;
                else{
                    x = i;
                    y = j;
                    z = k;
                    flg = true;
                    break;
                }
            } {
                int k = n - (i + j);
                if((i+j+k) != n || (10000*i + 5000*j + 1000*k) != s) continue;
                else{
                    x = i;
                    y = j;
                    z = k;
                    flg = true;
                    break;
                }
            } int k = n - (i + j); k n - (i + j) n (i + j) i j if((i+j+k) != n || (10000*i + 5000*j + 1000*k) != s) continue;
                else{
                    x = i;
                    y = j;
                    z = k;
                    flg = true;
                    break;
                } (i+j+k) != n || (10000*i + 5000*j + 1000*k) != s (i+j+k) != n (i+j+k) i+j+k i j k n (10000*i + 5000*j + 1000*k) != s (10000*i + 5000*j + 1000*k) 10000*i + 5000*j + 1000*k 10000*i 10000 i 5000*j 5000 j 1000*k 1000 k s continue; {
                    x = i;
                    y = j;
                    z = k;
                    flg = true;
                    break;
                } x = i x i y = j y j z = k z k flg = true flg true break; if(flg) break; flg 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 scan.close() scan.close scan String[] args args public class Main{

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
       
        int n = scan.nextInt();
        int s = scan.nextInt();

        int x = -1, y = -1, z = -1;
        boolean flg = false;
        for(int i=0; i<=n; i++){
            for(int j=0; j<=n-i; j++){
                int k = n - (i + j);
                if((i+j+k) != n || (10000*i + 5000*j + 1000*k) != s) continue;
                else{
                    x = i;
                    y = j;
                    z = k;
                    flg = true;
                    break;
                }
            }
            if(flg) break;
        }

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

        scan.close();
        
    }
} public class Main{

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
       
        int n = scan.nextInt();
        int s = scan.nextInt();

        int x = -1, y = -1, z = -1;
        boolean flg = false;
        for(int i=0; i<=n; i++){
            for(int j=0; j<=n-i; j++){
                int k = n - (i + j);
                if((i+j+k) != n || (10000*i + 5000*j + 1000*k) != s) continue;
                else{
                    x = i;
                    y = j;
                    z = k;
                    flg = true;
                    break;
                }
            }
            if(flg) break;
        }

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

        scan.close();
        
    }
} Main
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
       
        int n = scan.nextInt();
        int s = scan.nextInt();

        int x = -1, y = -1, z = -1;
        boolean flg = false;
        for(int i=0; i<=n; i++){
            for(int j=0; j<=n-i; j++){
                int k = n - (i + j);
                if((i+j+k) != n || (10000*i + 5000*j + 1000*k) != s) continue;
                else{
                    x = i;
                    y = j;
                    z = k;
                    flg = true;
                    break;
                }
            }
            if(flg) break;
        }

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

        scan.close();
        
    }
}