import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sum = sc.nextInt();
		int x = -1;
		int y = -1;
		int z = -1;
		for(int i = 0; i <= n; i++){
			for(int j = n - i; j >= 0; j--){
				int tmp = sum -(i * 10000 + j * 5000);
				int tmpn = (n - i - j) * 1000;
				if(tmp == tmpn){
					x = i;
					y = j;
					z = n - i - j;
					j = -1;
					i = n;
				}
			}
		}
		System.out.println(x + " " + y + " " + z);
	}

} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sum = sc.nextInt();
		int x = -1;
		int y = -1;
		int z = -1;
		for(int i = 0; i <= n; i++){
			for(int j = n - i; j >= 0; j--){
				int tmp = sum -(i * 10000 + j * 5000);
				int tmpn = (n - i - j) * 1000;
				if(tmp == tmpn){
					x = i;
					y = j;
					z = n - i - j;
					j = -1;
					i = n;
				}
			}
		}
		System.out.println(x + " " + y + " " + z);
	}

} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sum = sc.nextInt();
		int x = -1;
		int y = -1;
		int z = -1;
		for(int i = 0; i <= n; i++){
			for(int j = n - i; j >= 0; j--){
				int tmp = sum -(i * 10000 + j * 5000);
				int tmpn = (n - i - j) * 1000;
				if(tmp == tmpn){
					x = i;
					y = j;
					z = n - i - j;
					j = -1;
					i = n;
				}
			}
		}
		System.out.println(x + " " + y + " " + z);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sum = sc.nextInt();
		int x = -1;
		int y = -1;
		int z = -1;
		for(int i = 0; i <= n; i++){
			for(int j = n - i; j >= 0; j--){
				int tmp = sum -(i * 10000 + j * 5000);
				int tmpn = (n - i - j) * 1000;
				if(tmp == tmpn){
					x = i;
					y = j;
					z = n - i - j;
					j = -1;
					i = n;
				}
			}
		}
		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 sum = sc.nextInt(); sum sc.nextInt() sc.nextInt sc int x = -1; x -1 1 int y = -1; y -1 1 int z = -1; z -1 1 for(int i = 0; i <= n; i++){
			for(int j = n - i; j >= 0; j--){
				int tmp = sum -(i * 10000 + j * 5000);
				int tmpn = (n - i - j) * 1000;
				if(tmp == tmpn){
					x = i;
					y = j;
					z = n - i - j;
					j = -1;
					i = n;
				}
			}
		} int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
			for(int j = n - i; j >= 0; j--){
				int tmp = sum -(i * 10000 + j * 5000);
				int tmpn = (n - i - j) * 1000;
				if(tmp == tmpn){
					x = i;
					y = j;
					z = n - i - j;
					j = -1;
					i = n;
				}
			}
		} {
			for(int j = n - i; j >= 0; j--){
				int tmp = sum -(i * 10000 + j * 5000);
				int tmpn = (n - i - j) * 1000;
				if(tmp == tmpn){
					x = i;
					y = j;
					z = n - i - j;
					j = -1;
					i = n;
				}
			}
		} for(int j = n - i; j >= 0; j--){
				int tmp = sum -(i * 10000 + j * 5000);
				int tmpn = (n - i - j) * 1000;
				if(tmp == tmpn){
					x = i;
					y = j;
					z = n - i - j;
					j = -1;
					i = n;
				}
			} int j = n - i; int j = n - i; j n - i n i j >= 0 j 0 j-- j-- j {
				int tmp = sum -(i * 10000 + j * 5000);
				int tmpn = (n - i - j) * 1000;
				if(tmp == tmpn){
					x = i;
					y = j;
					z = n - i - j;
					j = -1;
					i = n;
				}
			} {
				int tmp = sum -(i * 10000 + j * 5000);
				int tmpn = (n - i - j) * 1000;
				if(tmp == tmpn){
					x = i;
					y = j;
					z = n - i - j;
					j = -1;
					i = n;
				}
			} int tmp = sum -(i * 10000 + j * 5000); tmp sum -(i * 10000 + j * 5000) sum (i * 10000 + j * 5000) i * 10000 i 10000 j * 5000 j 5000 int tmpn = (n - i - j) * 1000; tmpn (n - i - j) * 1000 (n - i - j) n - i - j n i j 1000 if(tmp == tmpn){
					x = i;
					y = j;
					z = n - i - j;
					j = -1;
					i = n;
				} tmp == tmpn tmp tmpn {
					x = i;
					y = j;
					z = n - i - j;
					j = -1;
					i = n;
				} x = i x i y = j y j z = n - i - j z n - i - j n - i - j n i j j = -1 j -1 1 i = n i n 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 public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sum = sc.nextInt();
		int x = -1;
		int y = -1;
		int z = -1;
		for(int i = 0; i <= n; i++){
			for(int j = n - i; j >= 0; j--){
				int tmp = sum -(i * 10000 + j * 5000);
				int tmpn = (n - i - j) * 1000;
				if(tmp == tmpn){
					x = i;
					y = j;
					z = n - i - j;
					j = -1;
					i = n;
				}
			}
		}
		System.out.println(x + " " + y + " " + z);
	}

} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sum = sc.nextInt();
		int x = -1;
		int y = -1;
		int z = -1;
		for(int i = 0; i <= n; i++){
			for(int j = n - i; j >= 0; j--){
				int tmp = sum -(i * 10000 + j * 5000);
				int tmpn = (n - i - j) * 1000;
				if(tmp == tmpn){
					x = i;
					y = j;
					z = n - i - j;
					j = -1;
					i = n;
				}
			}
		}
		System.out.println(x + " " + y + " " + z);
	}

} Main
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sum = sc.nextInt();
		int x = -1;
		int y = -1;
		int z = -1;
		for(int i = 0; i <= n; i++){
			for(int j = n - i; j >= 0; j--){
				int tmp = sum -(i * 10000 + j * 5000);
				int tmpn = (n - i - j) * 1000;
				if(tmp == tmpn){
					x = i;
					y = j;
					z = n - i - j;
					j = -1;
					i = n;
				}
			}
		}
		System.out.println(x + " " + y + " " + z);
	}

}