
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

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

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

		int n = sc.nextInt();
		int y = sc.nextInt();
	    int a = -1;
	    int b = -1;
	    int c = -1;
		
		for(int i=0;i<=n;i++) {
			for(int j=0;j<=n-i;j++) {
				if( 10000*i + 5000*j + 1000*(n-i-j) == y ) {
					a = i;
					b = j;
					c = n-i-j;
				}
			}
		}
		System.out.println(a + " " + b + " " + c);
	} main {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int y = sc.nextInt();
	    int a = -1;
	    int b = -1;
	    int c = -1;
		
		for(int i=0;i<=n;i++) {
			for(int j=0;j<=n-i;j++) {
				if( 10000*i + 5000*j + 1000*(n-i-j) == y ) {
					a = i;
					b = j;
					c = n-i-j;
				}
			}
		}
		System.out.println(a + " " + b + " " + c);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int y = sc.nextInt(); y sc.nextInt() sc.nextInt sc int a = -1; a -1 1 int b = -1; b -1 1 int c = -1; c -1 1 for(int i=0;i<=n;i++) {
			for(int j=0;j<=n-i;j++) {
				if( 10000*i + 5000*j + 1000*(n-i-j) == y ) {
					a = i;
					b = j;
					c = n-i-j;
				}
			}
		} int i=0; int i=0; i 0 i<=n i n i++ i++ i {
			for(int j=0;j<=n-i;j++) {
				if( 10000*i + 5000*j + 1000*(n-i-j) == y ) {
					a = i;
					b = j;
					c = n-i-j;
				}
			}
		} {
			for(int j=0;j<=n-i;j++) {
				if( 10000*i + 5000*j + 1000*(n-i-j) == y ) {
					a = i;
					b = j;
					c = n-i-j;
				}
			}
		} for(int j=0;j<=n-i;j++) {
				if( 10000*i + 5000*j + 1000*(n-i-j) == y ) {
					a = i;
					b = j;
					c = n-i-j;
				}
			} int j=0; int j=0; j 0 j<=n-i j n-i n i j++ j++ j {
				if( 10000*i + 5000*j + 1000*(n-i-j) == y ) {
					a = i;
					b = j;
					c = n-i-j;
				}
			} {
				if( 10000*i + 5000*j + 1000*(n-i-j) == y ) {
					a = i;
					b = j;
					c = n-i-j;
				}
			} if( 10000*i + 5000*j + 1000*(n-i-j) == y ) {
					a = i;
					b = j;
					c = n-i-j;
				} 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 {
					a = i;
					b = j;
					c = n-i-j;
				} a = i a i b = j b j c = n-i-j c n-i-j n-i-j n i j 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) {
		Scanner sc = new Scanner(System.in);

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

		int n = sc.nextInt();
		int y = sc.nextInt();
	    int a = -1;
	    int b = -1;
	    int c = -1;
		
		for(int i=0;i<=n;i++) {
			for(int j=0;j<=n-i;j++) {
				if( 10000*i + 5000*j + 1000*(n-i-j) == y ) {
					a = i;
					b = j;
					c = n-i-j;
				}
			}
		}
		System.out.println(a + " " + b + " " + c);
	}
} Main

import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int y = sc.nextInt();
	    int a = -1;
	    int b = -1;
	    int c = -1;
		
		for(int i=0;i<=n;i++) {
			for(int j=0;j<=n-i;j++) {
				if( 10000*i + 5000*j + 1000*(n-i-j) == y ) {
					a = i;
					b = j;
					c = n-i-j;
				}
			}
		}
		System.out.println(a + " " + b + " " + c);
	}
}
