#include <vector>
#include <stack>
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <typeinfo>
#include <queue>
#include <set>
#include <sstream>

using namespace std;

#define RSORT(c) sort((c).begin(),(c).end(),std::greater<int>())
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define SORT(c) sort((c).begin(),(c).end())

static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
#define MAX 200000
#define SENTINEL 10000000000
typedef long long ll;


void c1(){
  int l = 10;
  string s;
  cin >> s;
  //s[4] = "8";
  s.replace(3, 1, "8");
  cout << s << endl;
}

void c2(){
  int n;
  cin >> n;
  int tmp;
  vector<int> vec;
  REP(i,n){
    cin >> tmp;
    vec.push_back(tmp);
  }
  SORT(vec);
    //erace(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  cout << vec.size() << endl;
}

void c3(){
  int n;
  int m;
  cin >> n;
  cin >> m;
  int x,y,z;
  x=y=z=0;
  bool xf,yf,zf;
  xf=true;
  yf=zf=false;
  int now=0;
  REP(i,n){
    if(xf == true){
      if(now + 10000 > m){
        xf = false;
        yf=true;
      }
      else{
        x++;
        now += 10000;
      }
    }
    if(yf == true){
      if(now + 5000 > m){
        yf = false;
        zf=true;
      }
      else{
        y++;
        now += 5000;
      }
    }
    if(zf == true){
      if(now + 1000 > m){
        zf = false;
        break;
      }
      else{
        z++;
        now += 1000;
      }
    }
  }
  int ss = 0;
  ss = x+y+z;
  //cout << x << y << z << endl;
  //cout << ss << endl;
  bool dame = false;
  if (now < m){
    dame=true;
    //cout << -1 << " " <<  -1 << " " << -1;
  }
  int amari = n - ss;
  yf=true;
  xf=zf=false;
  if(x>0){
    y+=2*x;
    amari-=x;
    x=0;
  }
  while(amari > 0){
    if(xf){
      if(x - amari> 0){
        int diff=x-amari;
        x-= amari;
        y+=2*diff;
        amari=0;
        //cout << "a";
        //cout <<  "a";
      }
      else{
        xf=false;
        //yf=true;
        //dame=true;
        break;
      }
    }
    //cout <<"a" <<  amari << endl;
    if(yf){
      if(y>0 && amari > 3){
        int sho = amari / 4;
        int wei = amari % 4;
        y-=sho;
        z+=5*sho;
        amari-=4*sho;
      }
      else{
        yf=false;
        xf=true;
        //break;
        //dame=true;
        //break;
      }
    }
                   //cout << "b" << amari << endl;
  }
  if (amari > 0 && dame == false){
    if(amari==2){
      x+=2;
      y-=5;
      z+=5;
    }
    else{
      x+=1;
      y-=3;
      z+=5;
    }
    }
    //dame=false;
  if (dame==true){
    cout << -1 << " " <<  -1 << " " << -1 << endl;
  }
  else{
    cout << x << " " <<  y << " " << z << endl;
  }
}

void c4(){
  int n;
  int m;
  cin >> n;
  cin >> m;
  int x,y,z;
  x=y=z=0;
  bool xf,yf,zf;
  xf=true;
  yf=zf=false;
  int now=0;
  REP(i,n){
    if(xf == true){
      if(now + 10000 > m){
        xf = false;
        yf=true;
      }
      else{
        x++;
        now += 10000;
      }
    }
    if(yf == true){
      if(now + 5000 > m){
        yf = false;
        zf=true;
      }
      else{
        y++;
        now += 5000;
      }
    }
    if(zf == true){
      if(now + 1000 > m){
        zf = false;
        break;
      }
      else{
        z++;
        now += 1000;
      }
    }
  }
  int ss = 0;
  ss = x+y+z;
  //cout << x << y << z << endl;
  //cout << ss << endl;
  bool dame = false;
  int xn,yn,zn;
  if (now < m){
    dame=true;
    //cout << -1 << " " <<  -1 << " " << -1;
  }
  else{
    //int nokori= n - ss;
    //int sho = nokori/4;
    //int amari =nokori%4;
    zn = m / 1000;
    //int xn,yn;
    xn=yn=0;
    while(zn +yn >= n && zn >= 0){
      zn-=5;
      yn+=1;
    }
    //if (zn<0){
      zn+=5;
      yn--;
      //}
      int diff=n-zn;
      while(yn + xn >= diff && yn >= 0){
        yn-=2;
        xn+=1;
      }
      //cout << xn << " " << yn << " " << zn << endl;
        yn+=2;
        xn--;
      if( xn + yn + zn != n){
        dame = true;
      }
    }
  if (zn*1000 + yn*5000 + xn*10000 != m){
    dame =true;
  }
  if (dame==true){
    cout << -1 << " " <<  -1 << " " << -1 << endl;
  }
  else{
    cout << xn << " " <<  yn << " " << zn << endl;
  }
}

void c5(){
  int n,m;
  cin >> n >> m;
  bool dame = false;
  int xn,yn,zn;
    //int nokori= n - ss;
    //int sho = nokori/4;
    //int amari =nokori%4;
    zn = m / 1000;
    //int xn,yn;
    xn=yn=0;
    while(zn +yn >= n && zn >= 0){
      zn-=5;
      yn+=1;
    }
    //if (zn<0){
    zn+=5;
    yn--;
    //}
    int diff=n-zn;
    while(yn + xn >= diff && yn >= 0){
      yn-=2;
      xn+=1;
    }
    //cout << xn << " " << yn << " " << zn << endl;
    yn+=2;
    xn--;
    if( xn + yn + zn != n){
      dame = true;
    }
  if (zn*1000 + yn*5000 + xn*10000 != m){
    dame =true;
  }
  if (dame==true){
    cout << -1 << " " <<  -1 << " " << -1 << endl;
  }
  else{
    cout << xn << " " <<  yn << " " << zn << endl;
  }
  
}

int main(){
  //c1();
  c5();
  return 0;
}


Measured memory_bytes: 256