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

		Integer m = sc.nextInt();
		Integer p = sc.nextInt()/1000;

		Integer man = -1;
		Integer go = -1;
		Integer sen = -1;

		boolean judge = true;
		int i=0;
		do {
			int j=0;
			do {
				Integer tp = 5 * j + 1 * (m-i-j);
				if (tp == p - i * 10) {
					man = i;
					go = j;
					sen = m-i-j;
					judge = false;
				}
				j++;
//				System.out.println(String.valueOf(j));
			} while(j<=m-i && judge);
			i++;
		} while(i<=m && judge);

		String result = man.toString() + " " + go.toString() + " " + sen.toString();
		// 出力
		System.out.println(result);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		Integer m = sc.nextInt();
		Integer p = sc.nextInt()/1000;

		Integer man = -1;
		Integer go = -1;
		Integer sen = -1;

		boolean judge = true;
		int i=0;
		do {
			int j=0;
			do {
				Integer tp = 5 * j + 1 * (m-i-j);
				if (tp == p - i * 10) {
					man = i;
					go = j;
					sen = m-i-j;
					judge = false;
				}
				j++;
//				System.out.println(String.valueOf(j));
			} while(j<=m-i && judge);
			i++;
		} while(i<=m && judge);

		String result = man.toString() + " " + go.toString() + " " + sen.toString();
		// 出力
		System.out.println(result);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		Integer m = sc.nextInt();
		Integer p = sc.nextInt()/1000;

		Integer man = -1;
		Integer go = -1;
		Integer sen = -1;

		boolean judge = true;
		int i=0;
		do {
			int j=0;
			do {
				Integer tp = 5 * j + 1 * (m-i-j);
				if (tp == p - i * 10) {
					man = i;
					go = j;
					sen = m-i-j;
					judge = false;
				}
				j++;
//				System.out.println(String.valueOf(j));
			} while(j<=m-i && judge);
			i++;
		} while(i<=m && judge);

		String result = man.toString() + " " + go.toString() + " " + sen.toString();
		// 出力
		System.out.println(result);
	} main {
		Scanner sc = new Scanner(System.in);

		Integer m = sc.nextInt();
		Integer p = sc.nextInt()/1000;

		Integer man = -1;
		Integer go = -1;
		Integer sen = -1;

		boolean judge = true;
		int i=0;
		do {
			int j=0;
			do {
				Integer tp = 5 * j + 1 * (m-i-j);
				if (tp == p - i * 10) {
					man = i;
					go = j;
					sen = m-i-j;
					judge = false;
				}
				j++;
//				System.out.println(String.valueOf(j));
			} while(j<=m-i && judge);
			i++;
		} while(i<=m && judge);

		String result = man.toString() + " " + go.toString() + " " + sen.toString();
		// 出力
		System.out.println(result);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Integer m = sc.nextInt(); m sc.nextInt() sc.nextInt sc Integer p = sc.nextInt()/1000; p sc.nextInt()/1000 sc.nextInt() sc.nextInt sc 1000 Integer man = -1; man -1 1 Integer go = -1; go -1 1 Integer sen = -1; sen -1 1 boolean judge = true; judge true int i=0; i 0 do {
			int j=0;
			do {
				Integer tp = 5 * j + 1 * (m-i-j);
				if (tp == p - i * 10) {
					man = i;
					go = j;
					sen = m-i-j;
					judge = false;
				}
				j++;
//				System.out.println(String.valueOf(j));
			} while(j<=m-i && judge);
			i++;
		} while(i<=m && judge); i<=m && judge i<=m i m judge {
			int j=0;
			do {
				Integer tp = 5 * j + 1 * (m-i-j);
				if (tp == p - i * 10) {
					man = i;
					go = j;
					sen = m-i-j;
					judge = false;
				}
				j++;
//				System.out.println(String.valueOf(j));
			} while(j<=m-i && judge);
			i++;
		} int j=0; j 0 do {
				Integer tp = 5 * j + 1 * (m-i-j);
				if (tp == p - i * 10) {
					man = i;
					go = j;
					sen = m-i-j;
					judge = false;
				}
				j++;
//				System.out.println(String.valueOf(j));
			} while(j<=m-i && judge); j<=m-i && judge j<=m-i j m-i m i judge {
				Integer tp = 5 * j + 1 * (m-i-j);
				if (tp == p - i * 10) {
					man = i;
					go = j;
					sen = m-i-j;
					judge = false;
				}
				j++;
//				System.out.println(String.valueOf(j));
			} Integer tp = 5 * j + 1 * (m-i-j); tp 5 * j + 1 * (m-i-j) 5 * j 5 j 1 * (m-i-j) 1 (m-i-j) m-i-j m i j if (tp == p - i * 10) {
					man = i;
					go = j;
					sen = m-i-j;
					judge = false;
				} tp == p - i * 10 tp p - i * 10 p i * 10 i 10 {
					man = i;
					go = j;
					sen = m-i-j;
					judge = false;
				} man = i man i go = j go j sen = m-i-j sen m-i-j m-i-j m i j judge = false judge false j++ j i++ i String result = man.toString() + " " + go.toString() + " " + sen.toString(); result man.toString() + " " + go.toString() + " " + sen.toString() " " go.toString() man.toString() + " " + go.toString() + " " + sen.toString() man.toString() man.toString man " " go.toString() go.toString go " " sen.toString() sen.toString sen System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		Integer m = sc.nextInt();
		Integer p = sc.nextInt()/1000;

		Integer man = -1;
		Integer go = -1;
		Integer sen = -1;

		boolean judge = true;
		int i=0;
		do {
			int j=0;
			do {
				Integer tp = 5 * j + 1 * (m-i-j);
				if (tp == p - i * 10) {
					man = i;
					go = j;
					sen = m-i-j;
					judge = false;
				}
				j++;
//				System.out.println(String.valueOf(j));
			} while(j<=m-i && judge);
			i++;
		} while(i<=m && judge);

		String result = man.toString() + " " + go.toString() + " " + sen.toString();
		// 出力
		System.out.println(result);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		Integer m = sc.nextInt();
		Integer p = sc.nextInt()/1000;

		Integer man = -1;
		Integer go = -1;
		Integer sen = -1;

		boolean judge = true;
		int i=0;
		do {
			int j=0;
			do {
				Integer tp = 5 * j + 1 * (m-i-j);
				if (tp == p - i * 10) {
					man = i;
					go = j;
					sen = m-i-j;
					judge = false;
				}
				j++;
//				System.out.println(String.valueOf(j));
			} while(j<=m-i && judge);
			i++;
		} while(i<=m && judge);

		String result = man.toString() + " " + go.toString() + " " + sen.toString();
		// 出力
		System.out.println(result);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		Integer m = sc.nextInt();
		Integer p = sc.nextInt()/1000;

		Integer man = -1;
		Integer go = -1;
		Integer sen = -1;

		boolean judge = true;
		int i=0;
		do {
			int j=0;
			do {
				Integer tp = 5 * j + 1 * (m-i-j);
				if (tp == p - i * 10) {
					man = i;
					go = j;
					sen = m-i-j;
					judge = false;
				}
				j++;
//				System.out.println(String.valueOf(j));
			} while(j<=m-i && judge);
			i++;
		} while(i<=m && judge);

		String result = man.toString() + " " + go.toString() + " " + sen.toString();
		// 出力
		System.out.println(result);
	}
}