#include <stdio.h>
#include <iostream>
#include <climits>
#include <map>
#include <cmath>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <vector>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <utility>
#include <queue>
#include<bits/stdc++.h>

using namespace std;

/**templates**/
#define ll long long
#define LL long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define sd(x) scanf("%lf",&x)
#define ss(x) scanf("%s",x)
#define pi acos(-1.0)
#define pb push_back
#define inf 1LL<<62

int main()
{
    ll tst,a,b,m,n,res=0,ans=0,i,j,temp;
    bool ck=1;
    sl(n);
    sl(ans);
    a=ans/10000;
    b=ans/5000;
    for(i=a;i>=0;i--)
    {
        for(j=0;j<=b;j++)
        {
            temp=n-(i+j);
            if(temp<0)
                break;
            if((10000*i)+(5000*j)+(1000*temp)==ans)
                {
                    ck=0;
                    break;
                }

        }
        if(ck==0)
            break;
    }
    if(ck)
        printf("-1 -1 -1\n");
    else
        printf("%lld %lld %lld\n",i,j,temp);



    return 0;
}
