import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = Integer.parseInt(scan.next());
		int y = Integer.parseInt(scan.next());

		int man = -1;
		int gosen = -1;
		int sen = -1;

		loop: for(int i = 0; i <= n; ++i) {
			for(int j = 0; j<= n - i; ++j) {
				for(int k = 0; k<= n - i - j; ++k) {
					int sumMaisu = i + j + k;
					if(sumMaisu <= n && sumMaisu == n) {
						int sum = 10000 * i + 5000 * j + 1000 * k;
						if(sum == y) {
							man = i;
							gosen = j;
							sen = k;
							break loop;
						}
					}
				}
			}
		}

		System.out.println(man + " " + gosen + " " + sen);

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = Integer.parseInt(scan.next());
		int y = Integer.parseInt(scan.next());

		int man = -1;
		int gosen = -1;
		int sen = -1;

		loop: for(int i = 0; i <= n; ++i) {
			for(int j = 0; j<= n - i; ++j) {
				for(int k = 0; k<= n - i - j; ++k) {
					int sumMaisu = i + j + k;
					if(sumMaisu <= n && sumMaisu == n) {
						int sum = 10000 * i + 5000 * j + 1000 * k;
						if(sum == y) {
							man = i;
							gosen = j;
							sen = k;
							break loop;
						}
					}
				}
			}
		}

		System.out.println(man + " " + gosen + " " + sen);

	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = Integer.parseInt(scan.next());
		int y = Integer.parseInt(scan.next());

		int man = -1;
		int gosen = -1;
		int sen = -1;

		loop: for(int i = 0; i <= n; ++i) {
			for(int j = 0; j<= n - i; ++j) {
				for(int k = 0; k<= n - i - j; ++k) {
					int sumMaisu = i + j + k;
					if(sumMaisu <= n && sumMaisu == n) {
						int sum = 10000 * i + 5000 * j + 1000 * k;
						if(sum == y) {
							man = i;
							gosen = j;
							sen = k;
							break loop;
						}
					}
				}
			}
		}

		System.out.println(man + " " + gosen + " " + sen);

	} main {
		Scanner scan = new Scanner(System.in);
		int n = Integer.parseInt(scan.next());
		int y = Integer.parseInt(scan.next());

		int man = -1;
		int gosen = -1;
		int sen = -1;

		loop: for(int i = 0; i <= n; ++i) {
			for(int j = 0; j<= n - i; ++j) {
				for(int k = 0; k<= n - i - j; ++k) {
					int sumMaisu = i + j + k;
					if(sumMaisu <= n && sumMaisu == n) {
						int sum = 10000 * i + 5000 * j + 1000 * k;
						if(sum == y) {
							man = i;
							gosen = j;
							sen = k;
							break loop;
						}
					}
				}
			}
		}

		System.out.println(man + " " + gosen + " " + sen);

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = Integer.parseInt(scan.next()); n Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan int y = Integer.parseInt(scan.next()); y Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan int man = -1; man -1 1 int gosen = -1; gosen -1 1 int sen = -1; sen -1 1 System.out.println(man + " " + gosen + " " + sen) System.out.println System.out System System.out man + " " + gosen + " " + sen " " gosen man + " " + gosen + " " + sen man " " gosen " " sen String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = Integer.parseInt(scan.next());
		int y = Integer.parseInt(scan.next());

		int man = -1;
		int gosen = -1;
		int sen = -1;

		loop: for(int i = 0; i <= n; ++i) {
			for(int j = 0; j<= n - i; ++j) {
				for(int k = 0; k<= n - i - j; ++k) {
					int sumMaisu = i + j + k;
					if(sumMaisu <= n && sumMaisu == n) {
						int sum = 10000 * i + 5000 * j + 1000 * k;
						if(sum == y) {
							man = i;
							gosen = j;
							sen = k;
							break loop;
						}
					}
				}
			}
		}

		System.out.println(man + " " + gosen + " " + sen);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = Integer.parseInt(scan.next());
		int y = Integer.parseInt(scan.next());

		int man = -1;
		int gosen = -1;
		int sen = -1;

		loop: for(int i = 0; i <= n; ++i) {
			for(int j = 0; j<= n - i; ++j) {
				for(int k = 0; k<= n - i - j; ++k) {
					int sumMaisu = i + j + k;
					if(sumMaisu <= n && sumMaisu == n) {
						int sum = 10000 * i + 5000 * j + 1000 * k;
						if(sum == y) {
							man = i;
							gosen = j;
							sen = k;
							break loop;
						}
					}
				}
			}
		}

		System.out.println(man + " " + gosen + " " + sen);

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = Integer.parseInt(scan.next());
		int y = Integer.parseInt(scan.next());

		int man = -1;
		int gosen = -1;
		int sen = -1;

		loop: for(int i = 0; i <= n; ++i) {
			for(int j = 0; j<= n - i; ++j) {
				for(int k = 0; k<= n - i - j; ++k) {
					int sumMaisu = i + j + k;
					if(sumMaisu <= n && sumMaisu == n) {
						int sum = 10000 * i + 5000 * j + 1000 * k;
						if(sum == y) {
							man = i;
							gosen = j;
							sen = k;
							break loop;
						}
					}
				}
			}
		}

		System.out.println(man + " " + gosen + " " + sen);

	}

}
