#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,y,i,j,k,tmp,a,b,c,sum;
    cin>>n>>y;
    if(y%1000!=0)
    {
        printf("-1 -1 -1\n");
        return 0;
    }
    else{
        for(i=0;i<=n;i++)
        {
            for(j=0;j+i<=n;j++){
                k=n-i-j;
                tmp=(i*10000)+(j*5000)+(k*1000);
                if(tmp==y){
                    printf("%lld %lld %lld\n",i,j,k);
                    return 0;
                }
            }
        }
        printf("-1 -1 -1\n");
    }
}
