#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define int long long 
const int inf = 1e18;
#define D long double
#define NeedForSpeed ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
const int MOD = 1000000007;
#define fi first
#define se second
#define endl '\n'
// random_device rd;
// mt19937 rng(rd());
// int getRand(int l,int r){ // get random number in the range [l,r]
//   uniform_int_distribution<int> uid(l,r);
//   return uid(rng);
// }
const int N = 1e6 + 10;
int dp[4][3*N]={0};
int n , k ; 

void filler(){
    dp[0][0] = 1;
    dp[0][1] = -1;
    for(int i = 0 ; i <= 2 ; i++){
        for(int j = 1 ; j <= 3*n ; j++)
           dp[i][j] += dp[i][j-1];
        for(int j = 0 ; j <= 3*n ; j++){
               dp[i+1][j+1] += dp[i][j];
               if(j+n+1<=3*n)dp[i+1][j+n+1] -= dp[i][j];
        }
    }
    for(int j = 1 ; j <= 3*n ; j++)
        dp[3][j] += dp[3][j-1];  
}

void go(){
   cin >> n >> k ; 
   filler();
   // sum
   int sum ;
   int cur = 0;
   for(sum = 3 ; sum <= 3*n ; sum++){
       cur += dp[3][sum];
       if(cur >= k)break;
   }
   cur -= dp[3][sum];
   k -= cur;
   // our ans has sum == ans+1
   int i , j ;
   cur = 0; 
   // i
   for(i = 1 ; i <= n ; i++){
       // adding to cur -> total no of ways such that two elements sum is sum-i
       cur += dp[2][sum-i];
       if(cur >= k)break;
   }
   cur -= dp[2][sum-i];
   k -= cur;
   // now our i , fixed , sum is fixed , we will search for j
   cur = 0;
   for(j = 1; j <= n ; j++){
       // adding to cur -> total no of ways such that 1 elements sum is sum-i-j
       cur += dp[1][sum-i-j];
       if(cur >= k)break;
   }
   cur -= dp[1][sum-i-j];
   k -= cur;
   cout << i << " " << j << " " << (sum-(i+j)) << endl;
} 

signed main() {
        // freopen("input.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
        NeedForSpeed
        int t = 1;
        // cin >> t;
        while(t--){
            // cout << "Case #" << cases << ": ";
            go();
        }

}
#define MOD_TYPE 1

#pragma region Macros

#include <bits/stdc++.h>
using namespace std;

#if 0
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using Int = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
#endif
#if 0
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#endif
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9 + 10;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-9;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

struct io_init
{
  io_init()
  {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(30) << setiosflags(ios::fixed);
  };
} io_init;
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
template <typename T, typename U>
constexpr istream &operator>>(istream &is, pair<T, U> &p) noexcept
{
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename U>
constexpr ostream &operator<<(ostream &os, pair<T, U> &p) noexcept
{
  os << p.first << " " << p.second;
  return os;
}
#pragma endregion

// --------------------------------------

void solve()
{
  int a, b;
  cin >> a >> b;
  vector<ll> v;
  if (a >= b)
  {
    rep(i, a)
    {
      v.push_back(2 * i + 2);
    }
    rep(i, b - 1)
    {
      v.push_back(-(2 * i + 1));
    }
    ll sum = accumulate(all(v), 0LL);
    v.push_back(-sum);
  }
  else
  {
    rep(i, a - 1)
    {
      v.push_back(2 * i + 1);
    }
    rep(i, b)
    {
      v.push_back(-(2 * i + 2));
    }
    ll sum = accumulate(all(v), 0LL);
    v.push_back(-sum);
  }
  rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : " ");
}

int main()
{
  solve();
}