import java.util.Scanner;

//  C - Otoshidama

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int Y = Integer.parseInt(sc.next());
    Integer man = 0;
    Integer gosen = 0;
    Integer sen = 0;

    label: for(int i = 0; i <= N; i++) {
    	if(i * 10000 == Y && i == N) {
			man = i;
			break label;
    	}
    	for(int m = 0; m <= (N-i); m++) {
			if(i * 10000 + m * 5000 == Y && i + m == N) {
				man = i;
				gosen = m;
				break label;
			}

			for(int n = 0; n <= (N-i-m); n++) {
				if(i * 10000 + m * 5000 + n * 1000 == Y && i + m + n == N) {
					man = i;
					gosen = m;
					sen = n;
					break label;
				}
			}
    	}
    }
    if(man == 0 && gosen == 0 && sen ==0) {
    	System.out.println("-1 -1 -1");
    } else {
//		System.out.println(man*10000+gosen*5000+sen*1000);
//		System.out.println(man+gosen+sen);
		System.out.println(man.toString()+" "+gosen.toString()+" "+sen.toString());
    }


  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int Y = Integer.parseInt(sc.next());
    Integer man = 0;
    Integer gosen = 0;
    Integer sen = 0;

    label: for(int i = 0; i <= N; i++) {
    	if(i * 10000 == Y && i == N) {
			man = i;
			break label;
    	}
    	for(int m = 0; m <= (N-i); m++) {
			if(i * 10000 + m * 5000 == Y && i + m == N) {
				man = i;
				gosen = m;
				break label;
			}

			for(int n = 0; n <= (N-i-m); n++) {
				if(i * 10000 + m * 5000 + n * 1000 == Y && i + m + n == N) {
					man = i;
					gosen = m;
					sen = n;
					break label;
				}
			}
    	}
    }
    if(man == 0 && gosen == 0 && sen ==0) {
    	System.out.println("-1 -1 -1");
    } else {
//		System.out.println(man*10000+gosen*5000+sen*1000);
//		System.out.println(man+gosen+sen);
		System.out.println(man.toString()+" "+gosen.toString()+" "+sen.toString());
    }


  }
} Main public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int Y = Integer.parseInt(sc.next());
    Integer man = 0;
    Integer gosen = 0;
    Integer sen = 0;

    label: for(int i = 0; i <= N; i++) {
    	if(i * 10000 == Y && i == N) {
			man = i;
			break label;
    	}
    	for(int m = 0; m <= (N-i); m++) {
			if(i * 10000 + m * 5000 == Y && i + m == N) {
				man = i;
				gosen = m;
				break label;
			}

			for(int n = 0; n <= (N-i-m); n++) {
				if(i * 10000 + m * 5000 + n * 1000 == Y && i + m + n == N) {
					man = i;
					gosen = m;
					sen = n;
					break label;
				}
			}
    	}
    }
    if(man == 0 && gosen == 0 && sen ==0) {
    	System.out.println("-1 -1 -1");
    } else {
//		System.out.println(man*10000+gosen*5000+sen*1000);
//		System.out.println(man+gosen+sen);
		System.out.println(man.toString()+" "+gosen.toString()+" "+sen.toString());
    }


  } main {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int Y = Integer.parseInt(sc.next());
    Integer man = 0;
    Integer gosen = 0;
    Integer sen = 0;

    label: for(int i = 0; i <= N; i++) {
    	if(i * 10000 == Y && i == N) {
			man = i;
			break label;
    	}
    	for(int m = 0; m <= (N-i); m++) {
			if(i * 10000 + m * 5000 == Y && i + m == N) {
				man = i;
				gosen = m;
				break label;
			}

			for(int n = 0; n <= (N-i-m); n++) {
				if(i * 10000 + m * 5000 + n * 1000 == Y && i + m + n == N) {
					man = i;
					gosen = m;
					sen = n;
					break label;
				}
			}
    	}
    }
    if(man == 0 && gosen == 0 && sen ==0) {
    	System.out.println("-1 -1 -1");
    } else {
//		System.out.println(man*10000+gosen*5000+sen*1000);
//		System.out.println(man+gosen+sen);
		System.out.println(man.toString()+" "+gosen.toString()+" "+sen.toString());
    }


  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int Y = Integer.parseInt(sc.next()); Y Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Integer man = 0; man 0 Integer gosen = 0; gosen 0 Integer sen = 0; sen 0 if(man == 0 && gosen == 0 && sen ==0) {
    	System.out.println("-1 -1 -1");
    } else {
//		System.out.println(man*10000+gosen*5000+sen*1000);
//		System.out.println(man+gosen+sen);
		System.out.println(man.toString()+" "+gosen.toString()+" "+sen.toString());
    } man == 0 && gosen == 0 && sen ==0 man == 0 && gosen == 0 && sen ==0 man == 0 man 0 gosen == 0 gosen 0 sen ==0 sen 0 {
    	System.out.println("-1 -1 -1");
    } System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" {
//		System.out.println(man*10000+gosen*5000+sen*1000);
//		System.out.println(man+gosen+sen);
		System.out.println(man.toString()+" "+gosen.toString()+" "+sen.toString());
    } System.out.println(man.toString()+" "+gosen.toString()+" "+sen.toString()) System.out.println System.out System System.out man.toString()+" "+gosen.toString()+" "+sen.toString() " " gosen.toString() man.toString()+" "+gosen.toString()+" "+sen.toString() man.toString() man.toString man " " gosen.toString() gosen.toString gosen " " sen.toString() sen.toString sen String[] args args public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int Y = Integer.parseInt(sc.next());
    Integer man = 0;
    Integer gosen = 0;
    Integer sen = 0;

    label: for(int i = 0; i <= N; i++) {
    	if(i * 10000 == Y && i == N) {
			man = i;
			break label;
    	}
    	for(int m = 0; m <= (N-i); m++) {
			if(i * 10000 + m * 5000 == Y && i + m == N) {
				man = i;
				gosen = m;
				break label;
			}

			for(int n = 0; n <= (N-i-m); n++) {
				if(i * 10000 + m * 5000 + n * 1000 == Y && i + m + n == N) {
					man = i;
					gosen = m;
					sen = n;
					break label;
				}
			}
    	}
    }
    if(man == 0 && gosen == 0 && sen ==0) {
    	System.out.println("-1 -1 -1");
    } else {
//		System.out.println(man*10000+gosen*5000+sen*1000);
//		System.out.println(man+gosen+sen);
		System.out.println(man.toString()+" "+gosen.toString()+" "+sen.toString());
    }


  }
} public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int Y = Integer.parseInt(sc.next());
    Integer man = 0;
    Integer gosen = 0;
    Integer sen = 0;

    label: for(int i = 0; i <= N; i++) {
    	if(i * 10000 == Y && i == N) {
			man = i;
			break label;
    	}
    	for(int m = 0; m <= (N-i); m++) {
			if(i * 10000 + m * 5000 == Y && i + m == N) {
				man = i;
				gosen = m;
				break label;
			}

			for(int n = 0; n <= (N-i-m); n++) {
				if(i * 10000 + m * 5000 + n * 1000 == Y && i + m + n == N) {
					man = i;
					gosen = m;
					sen = n;
					break label;
				}
			}
    	}
    }
    if(man == 0 && gosen == 0 && sen ==0) {
    	System.out.println("-1 -1 -1");
    } else {
//		System.out.println(man*10000+gosen*5000+sen*1000);
//		System.out.println(man+gosen+sen);
		System.out.println(man.toString()+" "+gosen.toString()+" "+sen.toString());
    }


  }
} Main
import java.util.Scanner;

//  C - Otoshidama

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int Y = Integer.parseInt(sc.next());
    Integer man = 0;
    Integer gosen = 0;
    Integer sen = 0;

    label: for(int i = 0; i <= N; i++) {
    	if(i * 10000 == Y && i == N) {
			man = i;
			break label;
    	}
    	for(int m = 0; m <= (N-i); m++) {
			if(i * 10000 + m * 5000 == Y && i + m == N) {
				man = i;
				gosen = m;
				break label;
			}

			for(int n = 0; n <= (N-i-m); n++) {
				if(i * 10000 + m * 5000 + n * 1000 == Y && i + m + n == N) {
					man = i;
					gosen = m;
					sen = n;
					break label;
				}
			}
    	}
    }
    if(man == 0 && gosen == 0 && sen ==0) {
    	System.out.println("-1 -1 -1");
    } else {
//		System.out.println(man*10000+gosen*5000+sen*1000);
//		System.out.println(man+gosen+sen);
		System.out.println(man.toString()+" "+gosen.toString()+" "+sen.toString());
    }


  }
}