#include <iostream>
using namespace std;

int main() {
	int n,c,m;
	cin>>n>>m;
	for(int a=0;a<=n;a++){
		for(int b=0;b<=n;b++){
		c=n-a-b;
		if(c<0)break;
		if(m==a*10000+b*5000+c*1000){
			cout<<a<<' '<<b<<' '<<c;
			return 0;
		}
		}
	}
	cout<<-1<<' '<<-1<<' '<<-1;
	return 0;
}
