import java.util.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;


public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] ny = br.readLine().split(" ");
        int n = Integer.parseInt(ny[0]);
        int y = Integer.parseInt(ny[1]);
        int a10000 = -1;
        int a5000 = -1;
        int a1000 = -1;
        
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                if (10000*i + 5000*j + 1000*(n-i-j) == y && n-i-j >= 0) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = n-i-j;
                    break;
                }
            }
        }
        
        
        System.out.println(a10000 + " " + a5000 + " " + a1000);
    }
}


 import java.util.*; util.* java import java.io.InputStreamReader; InputStreamReader java.io import java.io.BufferedReader; BufferedReader java.io public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] ny = br.readLine().split(" ");
        int n = Integer.parseInt(ny[0]);
        int y = Integer.parseInt(ny[1]);
        int a10000 = -1;
        int a5000 = -1;
        int a1000 = -1;
        
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                if (10000*i + 5000*j + 1000*(n-i-j) == y && n-i-j >= 0) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = n-i-j;
                    break;
                }
            }
        }
        
        
        System.out.println(a10000 + " " + a5000 + " " + a1000);
    }
} Main public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] ny = br.readLine().split(" ");
        int n = Integer.parseInt(ny[0]);
        int y = Integer.parseInt(ny[1]);
        int a10000 = -1;
        int a5000 = -1;
        int a1000 = -1;
        
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                if (10000*i + 5000*j + 1000*(n-i-j) == y && n-i-j >= 0) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = n-i-j;
                    break;
                }
            }
        }
        
        
        System.out.println(a10000 + " " + a5000 + " " + a1000);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] ny = br.readLine().split(" ");
        int n = Integer.parseInt(ny[0]);
        int y = Integer.parseInt(ny[1]);
        int a10000 = -1;
        int a5000 = -1;
        int a1000 = -1;
        
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                if (10000*i + 5000*j + 1000*(n-i-j) == y && n-i-j >= 0) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = n-i-j;
                    break;
                }
            }
        }
        
        
        System.out.println(a10000 + " " + a5000 + " " + a1000);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] ny = br.readLine().split(" "); ny br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int n = Integer.parseInt(ny[0]); n Integer.parseInt(ny[0]) Integer.parseInt Integer ny[0] ny 0 int y = Integer.parseInt(ny[1]); y Integer.parseInt(ny[1]) Integer.parseInt Integer ny[1] ny 1 int a10000 = -1; a10000 -1 1 int a5000 = -1; a5000 -1 1 int a1000 = -1; a1000 -1 1 for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                if (10000*i + 5000*j + 1000*(n-i-j) == y && n-i-j >= 0) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = n-i-j;
                    break;
                }
            }
        } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
            for (int j = 0; j <= n; j++) {
                if (10000*i + 5000*j + 1000*(n-i-j) == y && n-i-j >= 0) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = n-i-j;
                    break;
                }
            }
        } {
            for (int j = 0; j <= n; j++) {
                if (10000*i + 5000*j + 1000*(n-i-j) == y && n-i-j >= 0) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = n-i-j;
                    break;
                }
            }
        } for (int j = 0; j <= n; j++) {
                if (10000*i + 5000*j + 1000*(n-i-j) == y && n-i-j >= 0) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = n-i-j;
                    break;
                }
            } int j = 0; int j = 0; j 0 j <= n j n j++ j++ j {
                if (10000*i + 5000*j + 1000*(n-i-j) == y && n-i-j >= 0) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = n-i-j;
                    break;
                }
            } {
                if (10000*i + 5000*j + 1000*(n-i-j) == y && n-i-j >= 0) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = n-i-j;
                    break;
                }
            } if (10000*i + 5000*j + 1000*(n-i-j) == y && n-i-j >= 0) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = n-i-j;
                    break;
                } 10000*i + 5000*j + 1000*(n-i-j) == y && n-i-j >= 0 10000*i + 5000*j + 1000*(n-i-j) == y 10000*i + 5000*j + 1000*(n-i-j) 10000*i + 5000*j + 1000*(n-i-j) 10000*i 10000 i 5000*j 5000 j 1000*(n-i-j) 1000 (n-i-j) n-i-j n i j y n-i-j >= 0 n-i-j n-i-j n i j 0 {
                    a10000 = i;
                    a5000 = j;
                    a1000 = n-i-j;
                    break;
                } a10000 = i a10000 i a5000 = j a5000 j a1000 = n-i-j a1000 n-i-j n-i-j n i j break; System.out.println(a10000 + " " + a5000 + " " + a1000) System.out.println System.out System System.out a10000 + " " + a5000 + " " + a1000 " " a5000 a10000 + " " + a5000 + " " + a1000 a10000 " " a5000 " " a1000 String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] ny = br.readLine().split(" ");
        int n = Integer.parseInt(ny[0]);
        int y = Integer.parseInt(ny[1]);
        int a10000 = -1;
        int a5000 = -1;
        int a1000 = -1;
        
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                if (10000*i + 5000*j + 1000*(n-i-j) == y && n-i-j >= 0) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = n-i-j;
                    break;
                }
            }
        }
        
        
        System.out.println(a10000 + " " + a5000 + " " + a1000);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] ny = br.readLine().split(" ");
        int n = Integer.parseInt(ny[0]);
        int y = Integer.parseInt(ny[1]);
        int a10000 = -1;
        int a5000 = -1;
        int a1000 = -1;
        
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                if (10000*i + 5000*j + 1000*(n-i-j) == y && n-i-j >= 0) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = n-i-j;
                    break;
                }
            }
        }
        
        
        System.out.println(a10000 + " " + a5000 + " " + a1000);
    }
} Main
import java.util.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;


public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] ny = br.readLine().split(" ");
        int n = Integer.parseInt(ny[0]);
        int y = Integer.parseInt(ny[1]);
        int a10000 = -1;
        int a5000 = -1;
        int a1000 = -1;
        
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                if (10000*i + 5000*j + 1000*(n-i-j) == y && n-i-j >= 0) {
                    a10000 = i;
                    a5000 = j;
                    a1000 = n-i-j;
                    break;
                }
            }
        }
        
        
        System.out.println(a10000 + " " + a5000 + " " + a1000);
    }
}



