import java.util.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int y = Integer.parseInt(sc.next());
		sc.close();
		sc = null;
		int a = -1;
		int b = -1;
		int c = -1;
		LABEL:for(i = 0; i <= n; i++) {
			for(j = 0; j <= n-i; j++) {
				if(i*10000 + j*5000 +(n-i-j)*1000 == y) {
					a=i;
					b=j;
					c=n-i-j;
					break LABEL;
				}
			}
		}
		System.out.println(""+a+" "+b+" "+c);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int y = Integer.parseInt(sc.next());
		sc.close();
		sc = null;
		int a = -1;
		int b = -1;
		int c = -1;
		LABEL:for(i = 0; i <= n; i++) {
			for(j = 0; j <= n-i; j++) {
				if(i*10000 + j*5000 +(n-i-j)*1000 == y) {
					a=i;
					b=j;
					c=n-i-j;
					break LABEL;
				}
			}
		}
		System.out.println(""+a+" "+b+" "+c);
	}
} Main public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int y = Integer.parseInt(sc.next());
		sc.close();
		sc = null;
		int a = -1;
		int b = -1;
		int c = -1;
		LABEL:for(i = 0; i <= n; i++) {
			for(j = 0; j <= n-i; j++) {
				if(i*10000 + j*5000 +(n-i-j)*1000 == y) {
					a=i;
					b=j;
					c=n-i-j;
					break LABEL;
				}
			}
		}
		System.out.println(""+a+" "+b+" "+c);
	} main {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int y = Integer.parseInt(sc.next());
		sc.close();
		sc = null;
		int a = -1;
		int b = -1;
		int c = -1;
		LABEL:for(i = 0; i <= n; i++) {
			for(j = 0; j <= n-i; j++) {
				if(i*10000 + j*5000 +(n-i-j)*1000 == y) {
					a=i;
					b=j;
					c=n-i-j;
					break LABEL;
				}
			}
		}
		System.out.println(""+a+" "+b+" "+c);
	} int i i j; j 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 sc.close() sc.close sc sc = null sc null int a = -1; a -1 1 int b = -1; b -1 1 int c = -1; c -1 1 System.out.println(""+a+" "+b+" "+c) System.out.println System.out System System.out ""+a+" "+b+" "+c " " b " " ""+a+" "+b+" "+c "" a " " b " " c String[] args args public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int y = Integer.parseInt(sc.next());
		sc.close();
		sc = null;
		int a = -1;
		int b = -1;
		int c = -1;
		LABEL:for(i = 0; i <= n; i++) {
			for(j = 0; j <= n-i; j++) {
				if(i*10000 + j*5000 +(n-i-j)*1000 == y) {
					a=i;
					b=j;
					c=n-i-j;
					break LABEL;
				}
			}
		}
		System.out.println(""+a+" "+b+" "+c);
	}
} public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int y = Integer.parseInt(sc.next());
		sc.close();
		sc = null;
		int a = -1;
		int b = -1;
		int c = -1;
		LABEL:for(i = 0; i <= n; i++) {
			for(j = 0; j <= n-i; j++) {
				if(i*10000 + j*5000 +(n-i-j)*1000 == y) {
					a=i;
					b=j;
					c=n-i-j;
					break LABEL;
				}
			}
		}
		System.out.println(""+a+" "+b+" "+c);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int y = Integer.parseInt(sc.next());
		sc.close();
		sc = null;
		int a = -1;
		int b = -1;
		int c = -1;
		LABEL:for(i = 0; i <= n; i++) {
			for(j = 0; j <= n-i; j++) {
				if(i*10000 + j*5000 +(n-i-j)*1000 == y) {
					a=i;
					b=j;
					c=n-i-j;
					break LABEL;
				}
			}
		}
		System.out.println(""+a+" "+b+" "+c);
	}
}