#include <bits/stdc++.h>
using namespace std;
typedef long long int_;
# define rep(i,a,b) for(int i=(a); i<=(b); ++i)
inline int readint(){
	int a = 0; char c = getchar(), f = 1;
	for(; c<'0'||c>'9'; c=getchar())
		if(c == '-') f = -f;
	for(; '0'<=c&&c<='9'; c=getchar())
		a = (a<<3)+(a<<1)+(c^48);
	return a*f;
}

const int MaxN = 1000000;
int_ dp[5][3*MaxN+1];

int main(){
	int n = readint(), sum, A, B;
	dp[0][0] = 1;
	rep(i,1,3) rep(j,i,i*n){
		dp[i][j] = dp[i][j-1]+dp[i-1][j-1];
		if(j > n) dp[i][j] -= dp[i-1][j-n-1];
// printf("dp[%d,%d] = %d\n",i,j,dp[i][j]);
	}
	int_ k; scanf("%lld",&k);
	for(sum=3; k>dp[3][sum]; ++sum)
		k -= dp[3][sum];
	for(A=1; k>dp[2][sum-A]; ++A)
		k -= dp[2][sum-A];
	for(B=1; k>dp[1][sum-A-B]; ++B)
		k -= dp[1][sum-A-B];
	printf("%d %d %d\n",A,B,sum-A-B);
	return 0;
}

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;++i)
#define repn(i,n) for(int i=1;i<=n;++i)
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

LL n,t;

LL calc(LL sum)
{
  LL lb=sum-n,ub=sum-1;
  lb=max(lb,2LL);ub=min(ub,n*2);
  if(ub<n+1) return (lb+ub-2)*(ub-lb+1)/2;
  if(lb>n+1) return (n*4-lb-ub+2)*(ub-lb+1)/2;
  return (lb+n-1)*(n-lb+2)/2+(n*3-ub+1)*(ub-n)/2-n;
}

LL calc2(LL sum,LL i)
{
  if(sum-i<2||sum-i>2*n) return 0;
  if(sum-i<=n+1) return sum-i-1;
  return n*2-(sum-i)+1;
}

int main()
{
  cin>>n>>t;
  LL sum;
  for(LL i=3;;++i)
  {
    LL val=calc(i);
    if(t-val<=0)
    {
      sum=i;
      break;
    }
    t-=val;
  }
  LL bea;
  for(LL i=1;;++i)
  {
    if(t-calc2(sum,i)<=0)
    {
      bea=i;
      break;
    }
    t-=calc2(sum,i);
  }
  LL tas=1;if(sum-bea-1>n) tas+=sum-bea-1-n;
  tas+=t-1;
  cout<<bea<<' '<<tas<<' '<<sum-bea-tas<<endl;
  return 0;
}