
#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>

using namespace std;

#define ll long long
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pii pair <int, int>
#define pll pair <ll, ll>
#define plp pair <int, pll >
#define pb push_back


int main(){
    ll int n,y,j;

while(cin>>n>>y){
        bool yes=0;

        for(int i=0;i<=n;i++){

            for(int k=0;k<=n;k++){
                    if(i+k<=n){

j=n-(i+k);

if(i*10000+k*5000+j*1000==y){

    yes=1;

cout<<i<<" "<<k<<" "<<j<<endl;
break;
}
                    }

            }
            if(yes){
                break;
            }
        }




if(!yes){


    cout<<"-1 -1 -1\n";
}


}



}
