#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define f first
#define s second
#define int long long
#define sz(x) (ll)(x.size())
using namespace std;
using namespace __gnu_pbds;
 
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

const int mod = 1e9+7;

int expo_pow(int x,int y){
 if(y == 0) return 1;
  y=y%(mod-1);
  x%=mod;
  if(y==0) y=mod-1;
  int res=1;
  while(y){
    if(y&1) res=(res*x)%mod;
    x=(x*x)%mod;
    y>>=1; 
  }
  return res;
}

ll add()
{
    return 0;
}

template <typename T, typename... Types>
T add(T var1, Types... var2){
    return (((((ll)(var1)) % mod + (ll)(add(var2...))) % mod) + mod) % mod;
}

ll mul(){
    return 1;
}

template <typename T, typename... Types>
T mul(T var1, Types... var2){
    return (((ll)(var1)) % mod * (ll)(mul(var2...))) % mod;
}

int ncr(int n,int r) {
  if (n < r) return 0;
  int num = n*(n-1);
  return num/2;
}

int n,k;

int get(int x) {
  int ans = 0;
  for (int i = 3; i < x; ++i) {
    for (int msk = 0; msk < 8; ++msk) {
      int cnt = __builtin_popcount(msk);
      if (cnt%2 == 0) ans += ncr(i-3+2 - cnt*(n),2);
      else ans -= ncr(i-3+2 - cnt*(n),2);
    }
  }
  return ans;
}

int ncr2(int n,int r) {
  if (n < r) return 0;
  return n;
}

int get2(int x) {
  int ans = 0;
  for (int i = 0; i < 4; ++i) {
    int cnt = __builtin_popcount(i);
    if(cnt%2 == 0) ans += ncr2(x-2+1-cnt*n,1);
    else ans -= ncr2(x-2+1-cnt*n,1);
  }
  return ans;
}

void solve(){
  cin >> n >> k;

  //cout << get(5) << "\n";

  // find beauty
  int st = 3;
  int end = 3*n;
  int tar_beauty = -1;
  while (end >= st) {
    int mid = (st + end)/2;
    int num_less = get(mid);
    if (num_less < k) {
      tar_beauty = mid;
      st = mid + 1;
    }
    else {
      end = mid - 1;
    }
  }
  int to_sub = get(tar_beauty);
  k -= to_sub;

  int be,ta,pop;
  for (int i = 1; i <= min(n,tar_beauty-2); ++i) {
    int req = tar_beauty - i;
    if (req > 2*n) continue;
    int tmp = get2(req);
    if (k <= tmp) {
      be = i;
      for (int i = 1; i <= n; ++i) {
        int tmp_pop = req - i;
        if (tmp_pop >= 1 and tmp_pop <= n) {
          k--;
        }
        if (k == 0) {
          cout << be << " " << i << " " << tmp_pop << "\n";
          return;
        }
      }
      break;
    }
    k-= tmp;
  }

}


signed main(){
  fast;
  int test = 1;
  int i=1;
  while(test--){
    solve();
  }
}




#include <bits/stdc++.h>

#define x first
#define y second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 1000010;

LL f[4][3 * N], n, k;

int main(){
    cin >> n >> k;
    f[0][0] = 1;
    for (int i = 0; i < 3; i ++) {
        for (int j = 0; j <= i * n; j ++){
            f[i + 1][j + 1] += f[i][j];
            f[i + 1][j + n + 1] -= f[i][j];
        }
        for (int j = 1; j <= (i + 1) * n; j ++)
            f[i + 1][j] += f[i + 1][j - 1];
    }
    int it = 3;
    int sum = 3;
    while (k > f[3][it])    k -= f[3][it], sum ++, it ++;
    int a = 1, b, c;
    for (int i = 1; i <= n; i ++) {
        int maxd = min((int)n, sum - i - 1);
        int mind = max(1, (int)(sum - i - n));
        if (mind > maxd)    continue;
        if (k <= maxd - mind + 1)   {
            a = i;
            break;
        }
        k -= (maxd - mind + 1);

    }
    c = min((int)n, sum - a - 1) - (k - 1);
    b = sum - a - c;
    cout << a << ' ' << b << ' ' << c;

    return 0;
}
