import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for(int a=0;a<=N;a++) {
			if(a*10000>Y) {
				break;
			}
			for(int b=0;b<=N;b++) {
				if((a*10000)+(b*5000)>Y) {
					break;
				}
					int c = N-(a+b);
					int sum = (10000*a)+(5000*b)+(1000*c);
					if(sum==Y) {
						System.out.println(a+" "+b+" "+c);
						System.exit(0);
					}
			}
		}
		System.out.print("-1 "+"-1 "+"-1");
	}
} 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 Y = sc.nextInt();
		for(int a=0;a<=N;a++) {
			if(a*10000>Y) {
				break;
			}
			for(int b=0;b<=N;b++) {
				if((a*10000)+(b*5000)>Y) {
					break;
				}
					int c = N-(a+b);
					int sum = (10000*a)+(5000*b)+(1000*c);
					if(sum==Y) {
						System.out.println(a+" "+b+" "+c);
						System.exit(0);
					}
			}
		}
		System.out.print("-1 "+"-1 "+"-1");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for(int a=0;a<=N;a++) {
			if(a*10000>Y) {
				break;
			}
			for(int b=0;b<=N;b++) {
				if((a*10000)+(b*5000)>Y) {
					break;
				}
					int c = N-(a+b);
					int sum = (10000*a)+(5000*b)+(1000*c);
					if(sum==Y) {
						System.out.println(a+" "+b+" "+c);
						System.exit(0);
					}
			}
		}
		System.out.print("-1 "+"-1 "+"-1");
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for(int a=0;a<=N;a++) {
			if(a*10000>Y) {
				break;
			}
			for(int b=0;b<=N;b++) {
				if((a*10000)+(b*5000)>Y) {
					break;
				}
					int c = N-(a+b);
					int sum = (10000*a)+(5000*b)+(1000*c);
					if(sum==Y) {
						System.out.println(a+" "+b+" "+c);
						System.exit(0);
					}
			}
		}
		System.out.print("-1 "+"-1 "+"-1");
	} 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 for(int a=0;a<=N;a++) {
			if(a*10000>Y) {
				break;
			}
			for(int b=0;b<=N;b++) {
				if((a*10000)+(b*5000)>Y) {
					break;
				}
					int c = N-(a+b);
					int sum = (10000*a)+(5000*b)+(1000*c);
					if(sum==Y) {
						System.out.println(a+" "+b+" "+c);
						System.exit(0);
					}
			}
		} int a=0; int a=0; a 0 a<=N a N a++ a++ a {
			if(a*10000>Y) {
				break;
			}
			for(int b=0;b<=N;b++) {
				if((a*10000)+(b*5000)>Y) {
					break;
				}
					int c = N-(a+b);
					int sum = (10000*a)+(5000*b)+(1000*c);
					if(sum==Y) {
						System.out.println(a+" "+b+" "+c);
						System.exit(0);
					}
			}
		} {
			if(a*10000>Y) {
				break;
			}
			for(int b=0;b<=N;b++) {
				if((a*10000)+(b*5000)>Y) {
					break;
				}
					int c = N-(a+b);
					int sum = (10000*a)+(5000*b)+(1000*c);
					if(sum==Y) {
						System.out.println(a+" "+b+" "+c);
						System.exit(0);
					}
			}
		} if(a*10000>Y) {
				break;
			} a*10000>Y a*10000 a 10000 Y {
				break;
			} break; for(int b=0;b<=N;b++) {
				if((a*10000)+(b*5000)>Y) {
					break;
				}
					int c = N-(a+b);
					int sum = (10000*a)+(5000*b)+(1000*c);
					if(sum==Y) {
						System.out.println(a+" "+b+" "+c);
						System.exit(0);
					}
			} int b=0; int b=0; b 0 b<=N b N b++ b++ b {
				if((a*10000)+(b*5000)>Y) {
					break;
				}
					int c = N-(a+b);
					int sum = (10000*a)+(5000*b)+(1000*c);
					if(sum==Y) {
						System.out.println(a+" "+b+" "+c);
						System.exit(0);
					}
			} {
				if((a*10000)+(b*5000)>Y) {
					break;
				}
					int c = N-(a+b);
					int sum = (10000*a)+(5000*b)+(1000*c);
					if(sum==Y) {
						System.out.println(a+" "+b+" "+c);
						System.exit(0);
					}
			} if((a*10000)+(b*5000)>Y) {
					break;
				} (a*10000)+(b*5000)>Y (a*10000)+(b*5000) (a*10000) a 10000 (b*5000) b 5000 Y {
					break;
				} break; int c = N-(a+b); c N-(a+b) N (a+b) a b int sum = (10000*a)+(5000*b)+(1000*c); sum (10000*a)+(5000*b)+(1000*c) (10000*a)+(5000*b)+(1000*c) (10000*a) 10000 a (5000*b) 5000 b (1000*c) 1000 c if(sum==Y) {
						System.out.println(a+" "+b+" "+c);
						System.exit(0);
					} sum==Y sum Y {
						System.out.println(a+" "+b+" "+c);
						System.exit(0);
					} System.out.println(a+" "+b+" "+c) System.out.println System.out System System.out a+" "+b+" "+c " " b a+" "+b+" "+c a " " b " " c System.exit(0) System.exit System 0 System.out.print("-1 "+"-1 "+"-1") System.out.print System.out System System.out "-1 "+"-1 "+"-1" "-1 "+"-1 "+"-1" "-1 " "-1 " "-1" 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();
		for(int a=0;a<=N;a++) {
			if(a*10000>Y) {
				break;
			}
			for(int b=0;b<=N;b++) {
				if((a*10000)+(b*5000)>Y) {
					break;
				}
					int c = N-(a+b);
					int sum = (10000*a)+(5000*b)+(1000*c);
					if(sum==Y) {
						System.out.println(a+" "+b+" "+c);
						System.exit(0);
					}
			}
		}
		System.out.print("-1 "+"-1 "+"-1");
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for(int a=0;a<=N;a++) {
			if(a*10000>Y) {
				break;
			}
			for(int b=0;b<=N;b++) {
				if((a*10000)+(b*5000)>Y) {
					break;
				}
					int c = N-(a+b);
					int sum = (10000*a)+(5000*b)+(1000*c);
					if(sum==Y) {
						System.out.println(a+" "+b+" "+c);
						System.exit(0);
					}
			}
		}
		System.out.print("-1 "+"-1 "+"-1");
	}
} 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 Y = sc.nextInt();
		for(int a=0;a<=N;a++) {
			if(a*10000>Y) {
				break;
			}
			for(int b=0;b<=N;b++) {
				if((a*10000)+(b*5000)>Y) {
					break;
				}
					int c = N-(a+b);
					int sum = (10000*a)+(5000*b)+(1000*c);
					if(sum==Y) {
						System.out.println(a+" "+b+" "+c);
						System.exit(0);
					}
			}
		}
		System.out.print("-1 "+"-1 "+"-1");
	}
}