public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);
		System.out.println(Main.calc(s.nextInt(), s.nextInt()));
	}
	public static String calc(int n,int y) {
		for(int i=0;i<=n;i++) {
			for(int j=0;i+j<=n;j++) {
				int k = n-(i+j);
				if(i+j+k==n && i*10000+j*5000+k*1000==y) {
					return i+" "+j+" "+k;
				}
			}
		}
		return "-1 -1 -1";
	}
} public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);
		System.out.println(Main.calc(s.nextInt(), s.nextInt()));
	}
	public static String calc(int n,int y) {
		for(int i=0;i<=n;i++) {
			for(int j=0;i+j<=n;j++) {
				int k = n-(i+j);
				if(i+j+k==n && i*10000+j*5000+k*1000==y) {
					return i+" "+j+" "+k;
				}
			}
		}
		return "-1 -1 -1";
	}
} Main public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);
		System.out.println(Main.calc(s.nextInt(), s.nextInt()));
	} main {
		java.util.Scanner s = new java.util.Scanner(System.in);
		System.out.println(Main.calc(s.nextInt(), s.nextInt()));
	} java.util.Scanner s = new java.util.Scanner(System.in); s new java.util.Scanner(System.in) System.out.println(Main.calc(s.nextInt(), s.nextInt())) System.out.println System.out System System.out Main.calc(s.nextInt(), s.nextInt()) Main.calc Main s.nextInt() s.nextInt s s.nextInt() s.nextInt s String[] args args public static String calc(int n,int y) {
		for(int i=0;i<=n;i++) {
			for(int j=0;i+j<=n;j++) {
				int k = n-(i+j);
				if(i+j+k==n && i*10000+j*5000+k*1000==y) {
					return i+" "+j+" "+k;
				}
			}
		}
		return "-1 -1 -1";
	} calc {
		for(int i=0;i<=n;i++) {
			for(int j=0;i+j<=n;j++) {
				int k = n-(i+j);
				if(i+j+k==n && i*10000+j*5000+k*1000==y) {
					return i+" "+j+" "+k;
				}
			}
		}
		return "-1 -1 -1";
	} for(int i=0;i<=n;i++) {
			for(int j=0;i+j<=n;j++) {
				int k = n-(i+j);
				if(i+j+k==n && i*10000+j*5000+k*1000==y) {
					return i+" "+j+" "+k;
				}
			}
		} int i=0; int i=0; i 0 i<=n i n i++ i++ i {
			for(int j=0;i+j<=n;j++) {
				int k = n-(i+j);
				if(i+j+k==n && i*10000+j*5000+k*1000==y) {
					return i+" "+j+" "+k;
				}
			}
		} {
			for(int j=0;i+j<=n;j++) {
				int k = n-(i+j);
				if(i+j+k==n && i*10000+j*5000+k*1000==y) {
					return i+" "+j+" "+k;
				}
			}
		} for(int j=0;i+j<=n;j++) {
				int k = n-(i+j);
				if(i+j+k==n && i*10000+j*5000+k*1000==y) {
					return i+" "+j+" "+k;
				}
			} int j=0; int j=0; j 0 i+j<=n i+j i j n j++ j++ j {
				int k = n-(i+j);
				if(i+j+k==n && i*10000+j*5000+k*1000==y) {
					return i+" "+j+" "+k;
				}
			} {
				int k = n-(i+j);
				if(i+j+k==n && i*10000+j*5000+k*1000==y) {
					return i+" "+j+" "+k;
				}
			} int k = n-(i+j); k n-(i+j) n (i+j) i j if(i+j+k==n && i*10000+j*5000+k*1000==y) {
					return i+" "+j+" "+k;
				} i+j+k==n && i*10000+j*5000+k*1000==y i+j+k==n i+j+k i+j+k i j k n i*10000+j*5000+k*1000==y i*10000+j*5000+k*1000 i*10000+j*5000+k*1000 i*10000 i 10000 j*5000 j 5000 k*1000 k 1000 y {
					return i+" "+j+" "+k;
				} return i+" "+j+" "+k; i+" "+j+" "+k " " j i+" "+j+" "+k i " " j " " k return "-1 -1 -1"; "-1 -1 -1" int n n int y y public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);
		System.out.println(Main.calc(s.nextInt(), s.nextInt()));
	}
	public static String calc(int n,int y) {
		for(int i=0;i<=n;i++) {
			for(int j=0;i+j<=n;j++) {
				int k = n-(i+j);
				if(i+j+k==n && i*10000+j*5000+k*1000==y) {
					return i+" "+j+" "+k;
				}
			}
		}
		return "-1 -1 -1";
	}
} public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);
		System.out.println(Main.calc(s.nextInt(), s.nextInt()));
	}
	public static String calc(int n,int y) {
		for(int i=0;i<=n;i++) {
			for(int j=0;i+j<=n;j++) {
				int k = n-(i+j);
				if(i+j+k==n && i*10000+j*5000+k*1000==y) {
					return i+" "+j+" "+k;
				}
			}
		}
		return "-1 -1 -1";
	}
} Main
public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);
		System.out.println(Main.calc(s.nextInt(), s.nextInt()));
	}
	public static String calc(int n,int y) {
		for(int i=0;i<=n;i++) {
			for(int j=0;i+j<=n;j++) {
				int k = n-(i+j);
				if(i+j+k==n && i*10000+j*5000+k*1000==y) {
					return i+" "+j+" "+k;
				}
			}
		}
		return "-1 -1 -1";
	}
}