#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const long long LL_INF = 1ll * INF * INF;
const int MAX_N = 100000 + 7;
template <typename T>
inline void addmod(T& a, const long long& b, const int& MOD = INF) {
  a = (a + b) % MOD;
  if (a < 0) a += MOD;
}
void solve() {
  int a, b;
  cin >> a >> b;
  int sum = 0;
  int n = 0;
  while (sum + n + 1 <= a + b) {
    sum += ++n;
  }
  vector<int> lhs, rhs;
  while (n > 0) {
    if (n <= a) {
      lhs.push_back(n);
      a -= n;
    } else {
      rhs.push_back(n);
    }
    --n;
  }
  cout << lhs.size() << '\n';
  for (int x : lhs) cout << x << ' ';
  cout << '\n';
  cout << rhs.size() << '\n';
  for (int x : rhs) cout << x << ' ';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  const bool multiple_test = false;
  int test = 1;
  if (multiple_test) cin >> test;
  for (int i = 0; i < test; ++i) {
    solve();
  }
}
