#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    int n;
    ll y;
    cin >> n >> y;

    for(ll i=0;10000*i<=y;i++){
        ll x=y-10000*i;
        for(ll j=0;5000*j<=x;j++){
            ll k=(x-5000*j)/1000;
            if(i+j+k==n){
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }

    cout << -1 << " " << -1 << " " << -1 << endl;

    return 0;
}

#include<iostream>
#include<cmath>

using namespace std;

int main() {
  int N, Y;
  cin >> N >> Y;
  string ans = "-1 -1 -1";
  for (int i = 0; i <= N; ++i) {
    for (int j = 0; j <= N; ++j) {
      int k = N - j - i;
      if (k < 0) continue;
      if (i * 10000 + j * 5000 + k * 1000 == Y) {
        ans = to_string(i) + ' ' + to_string(j) + ' ' + to_string(k);
        break;
      }
    }
    if (ans != "-1 -1 -1") break;
  }
  cout << ans << endl;
}