#include <iostream>

using namespace std;
using LL = long long;

const int kMaxN = 1e6 + 1;

LL f[4][kMaxN * 3];
LL n, k, s;

int main() {
  cin >> n >> k;
  f[0][0] = 1;
  for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= 3 * n; j++) {
      f[i][j] = f[i][j - 1] + f[i - 1][j - 1] - (j > n ? f[i - 1][j - 1 - n] : 0);
    }
  }
  for (s = 3; k > f[3][s]; s++) {
    k -= f[3][s];
  }
  for (int i = 2, v; i >= 1; i--) {
    for (v = 1; k > f[i][s - v]; v++) {
      k -= f[i][s - v];
    }
    cout << v << " ";
    s -= v;
  }
  cout << s;
  return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define lli long long int
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define plli pair<lli,lli>
#define vi vector<int>
#define vlli vector<lli>
#define vpi vector<pii>
#define vplli vector<plli>
#define mi map<int,int>
#define mlli map<lli,lli>
#define forl(i,a,b) for(lli i=a;i<b;i++)
#define ford(i,a,b) for(lli i=a;i>=b;i--)
#define cout0(a) cout << a << endl
#define cout1(a) cout << a << " "
#define cout2(a,b) cout << a << " " << b << endl
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl

lli gcd(lli a,lli b)
{
    if(b>a)
    {
      lli t=a;
      a=b;
      b=t;
    }

    while(b!=0)
    {
      lli t = a;
      a = b;
      b = t%b;
    }

    return a;
}

bool sortbysec(const pair<lli,lli> &a,const pair<lli,lli> &b)
{
    return (a.first < b.first);
}

void dfs(vlli v[],lli s,lli depth[],lli isvisited[])
{
  forl(i,0,v[s].size())
  {
    lli t=v[s][i];
    if(!isvisited[t])
    {
      depth[t]=depth[s]+1;
      isvisited[t]++;
      dfs(v,t,depth,isvisited);
    }
  }
}

lli nCr(lli n,lli r)
{
  lli p = 1,k = 1;
  if (n-r < r) r = n - r;

  if (r != 0)
  {
    while (r)
    {
      p*=n;
      k*=r;

      lli m = __gcd(p, k);

      p/=m;
      k/=m;

      n--;
      r--;
    }
  }
  else p = 1;

  return p;
}

lli SieveOfEratosthenes(lli n)
{
  bool prime[n+1];
  memset(prime,true,n+1);
  forl(i,2,n+1)
    if(prime[i])
      for(lli j=2*i;j<n+1;j+=i)
        prime[i]=false;

  lli count=0;
  forl(i,2,n+1)
    if(prime[i]) count++;
  return count;
}

int main()
{
  fastio;
  // time_t start, end;
  // time(&start);

  lli q;
  // cin >> q;
  q = 1;
  while(q--)
  {
    lli n,k;
    cin >> n >> k;

    lli kthcake = 0;

    lli r = 0;
    lli sum = 0;
    for(r=3; r<=3*n;r++)
    {
      sum = (r-1)*(r-2)/2;
      if(r-n-1 >= 2) sum -= 3*(((r-n-1)*(r-n-2))/2);
      if(r-2*n-1 >= 2) sum += 3*(((r-2*n-1)*(r-2*n-2))/2);

      kthcake += sum;

      if(kthcake >= k) break;
    }

    kthcake -= sum;

    lli diff = k - kthcake;

    int r1 = 0;
    lli requiredcake = 0;
    for(r1=1; r1<=n; r1++)
    {
      sum = r-r1-1;
      if(r-r1-n-1 >= 1) sum -= 2*(r-r1-n-1);
      if(r-r1-2*n-1 >= 1) sum += (r-r1-2*n-1);

      requiredcake += sum;

      if(requiredcake >= diff) break;
    }

    requiredcake -= sum;


    lli diff2 = diff - requiredcake;

    int r2 = 0;
    lli requiredcake2 = 0;
    for(r2=1; r2<=n; r2++)
    {
      sum = 1;
      if(r-r1-r2-n-1 >= 0) sum -= 1;

      requiredcake2 += sum;

      if(requiredcake2 == diff2) break;
    }

    lli beauty_ans = r1;
    lli taste_ans = r2;
    lli popularity_ans = r - (beauty_ans + taste_ans);

    cout3(beauty_ans,taste_ans,popularity_ans);
  }

  // time(&end);
  // cout<<fixed<<double(end - start)<<setprecision(10)<<endl;
}
