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

#define ll                     long long
#define loop( i,a)             for(i=0;i<a;i++)
#define loop1(i,a)             for(i=1;i<=a;i++)
#define ppp(a)                 cout<<a<<endl;
#define sscd(a)                scanf("%lf",&a)
#define sss(a)                 cin>>a
#define scc(a)                 scanf("%c",&a)
#define FOR(i,a,b)             for(i=a;i<b;i++)
#define FORE(i,a,b)            for(i=a;i<=b;i++)
#define reverses(s)            reverse(s.begin(),s.end())
#define inf                    9000000000000000
#define pii                    3.1415926536
#define pb(a)                  push_back(a)
#define pppp(a,b)              cout<<a<<"  "<<b;
#define newline                printf("\n");
#define sorted(a)               sort(a.begin(),a.end())


int main()
{
    ll n,y,m,r10k=0,r5k=0,r1k=0,nn,r;
    cin>>n>>y;
    m=y;
    r10k=m/10000;
    m=m%10000;
    r5k=m/5000;
    m=m%5000;
    r1k=m/1000;
    m=m%1000;
    if(m>0)
    {
        ppp("-1 -1 -1")
        return 0;
    }
    if(n<(r10k+r5k+r1k))
    {
        ppp("-1 -1 -1")
        return 0;
    }
    if(n==(r10k+r5k+r1k))
    {
        printf("%lld %lld %lld\n",r10k,r5k,r1k);
        return 0;
    }
    nn=y/1000;
    for(ll i=0;i<=20000;i++)
    {
        for(ll j=0;j<=10000;j++ )
        {
            if(i+j*5>nn)
                continue;
            if((nn-(i+5*j))%10==0)
            {
                if((i+j+(nn-(i+5*j))/10)==n)
                {
                    printf("%lld %lld %lld\n",(nn-(i+5*j))/10,j,i);
                    return 0;
                }
            }
        }
    }

        ppp("-1 -1 -1")

    return 0;
}
