// Original C++ solution (slower):
/// Bismillahir Rahmanir Rahim

/// S. M. Shakir Ahsan Romeo



#include <bits/stdc++.h>

//#include <ext/pb_ds/assoc_container.hpp>

//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;

//using namespace __gnu_pbds;



const double PI = acos(-1.0);



typedef long long lng;

typedef unsigned long long ulng;

typedef double db;

typedef pair < int, int >  pii;

typedef vector < pii >  vpii;

//typedef tree < int, null_type, less < int >, rb_tree_tag, tree_order_statistics_node_update > ordered_set;



inline int getint()

{

    int x;

    scanf("%d", &x);

    return x;

}

#define II getint()



inline long long getlng()

{

    long long x;

    scanf("%lld", &x);

    return x;

}

#define LL getlng()



int dx4[] = {-1, 0, 1, 0};

int dy4[] = {0, 1, 0, -1};

int dx8[] = {-1, -1, -1, 0, 0, 1, 1, 1};

int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1};





void solve();

#define theromeo421 main()

#define segtree int lft = node << 1, rgt = lft | 1, mid = (b + e) >> 1;

#define mem(x, y) memset((x), (y), sizeof (x));

#define sz(x) ((int)x.size())

#define max3(a,b,c) max(a, max(b,c))

#define min3(a,b,c) min(a, min(b,c))

#define pr1(x) cout << x << endl

#define pr2(x,y) cout << x << ' ' << y << endl

#define rep(i, n) for(int i = 0; i < n; ++i)

#define rep1(i, n) for(int i = 1; i <= n; ++i)

#define repstl(it, x) for(auto it = x.begin(); it != x.end(); it++)

#define forcon(pp , qq) for(const auto& pp : qq)

#define all(x) (x).begin(), (x).end()

#define Unique(x) sort(all(x)); x.erase(unique(all(x)), x.end()); /// x needs to be sorted first

#define pb push_back

#define wait system("pause")

#define xx first

#define yy second

#define dbg(x) cerr << #x << "=" << x << endl;

#define dbg2(x, y) cerr << #x << "=" << x << ", " << #y << "=" << y << endl;

#define read(a) freopen(a, "r", stdin);

#define write(a) freopen(a, "w", stdout);

#define prv(v) rep(i, sz(v)) cout << v[i] << " \n"[i + 1 == v.size()];

#define Case int T; scanf("%d", &T); for(int cas = 1; cas <= T; ++cas)

#define pf printf

#define sf scanf

#define MP make_pair

#define endl '\n'

const double eps = (double)1e-9;





int theromeo421

{

    /// PLEASE HACK my code, I am error prone.

    /// Your hack can save me from the cruel hand of system testing. :) :P ;)

    solve();

#ifdef romeo

    cerr << "\nElapsed time: " << 1.0 * clock() / CLOCKS_PER_SEC << '\n';

#endif // romeo

    return 0;

}





void solve()

{

    int n, tot;

    while(cin >> n >> tot)

    {

        int a1 = -1, a2 = -1, a3 = -1;

        for(int x = 0; x * 10000 <= tot && a1 == -1; ++x)

        {

            for(int y = 0; x * 10000 + y * 5000 <= tot; ++y)

            {

                int baki = tot - (x * 10000 + y * 5000);

                if(baki % 1000 == 0 && x + y + baki / 1000 == n)

                {

                    a1 = x, a2 = y, a3 = baki / 1000;

                    break;

                }

            }

        }

        pf("%d %d %d\n", a1, a2, a3);

    }

}


// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int n,m;

int main()

{

	scanf("%d%d",&n,&m);

	for(register int x=0;x<=n;x++)

		for(register int y=0;y<=n;y++)

				if(x*10000+y*5000+(n-x-y)*1000==m && x>=0 && y>=0 && n-x-y>=0)

				{

					printf("%d %d %d",x,y,n-x-y);

					return 0;

				}

	printf("-1 -1 -1");

	return 0;

}

// Fastest known solution for this problem: