#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main()
{   
    int n;
    ll y;
    cin >> n >> y;

    int ansI = -1, ansJ = -1, ansK = -1;
    rep(i, n+1) rep(j, n+1) {
        int k = n-i-j;
        if(k < 0) continue;
        if(10000*i+5000*j+1000*k == y) {
            ansI = i, ansJ = j, ansK = k;
        }
    }

    cout << ansI << " " << ansJ << " " << ansK << endl;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define deb(x) cerr<<"["#x<<" : "<<x<<" ]\n";

int main()
{
	using ll = long long;
	ll n, y;
	cin >> n >> y;
	ll k = y - 1000*n;
	deb(k);
	int b = 0, a = 0;
	
	while(true) {
		if((k - (4000*b)) < 0) {
			puts("-1 -1 -1");
			return 0;
		}
		
		if((k - 4000*b) % 9000 == 0) {
			a = (k - 4000*b) / 9000;
			deb(a);
			deb(b);
			break;
		}
		b++;
	}
	
	if((n - a - b) < 0) puts("-1 -1 -1");
	else cout << a << ' ' << b << ' ' << n-a-b;
	
}
