#include <bits/stdc++.h>
using namespace std;
using LD = long double;
using PLL = pair<long long, long long>;
using VII = vector<pair<int, int> >;
template <class T>
bool power_2(T v) {
  static_assert(std::is_integral<T>::value, "type should be integral");
  return v && !(v & (v - 1));
}
template <class T>
istream& operator>>(istream& st, vector<T>& container) {
  for (auto& u : container) st >> u;
  return st;
}
template <class T>
ostream& operator<<(ostream& st, const vector<T>& container) {
  for (auto& u : container) st << u << '\n';
  return st;
}
template <class T, size_t N>
istream& operator>>(istream& st, array<T, N>& container) {
  for (auto& u : container) st >> u;
  return st;
}
template <class T, size_t N>
ostream& operator<<(ostream& st, const array<T, N>& container) {
  for (auto u : container) st << u << ' ';
  return st;
}
template <class T, class U>
istream& operator>>(istream& st, pair<T, U>& p) {
  st >> p.first >> p.second;
  return st;
}
template <class T, class U>
ostream& operator<<(ostream& st, pair<T, U> p) {
  st << p.first << ' ' << p.second;
  return st;
}
template <class T, class U, class V>
pair<T, U> operator*(pair<T, U> p, V val) {
  return {p.first * val, p.second * val};
}
template <class T, class U, class V>
pair<T, U> operator/(pair<T, U> p, V val) {
  return {p.first / val, p.second / val};
}
template <class T, class U>
pair<T, U> operator-(pair<T, U> a, pair<T, U> b) {
  return {a.first - b.first, a.second - b.second};
}
template <class T, class U>
pair<T, U> operator+(pair<T, U> a, pair<T, U> b) {
  return {a.first + b.first, a.second + b.second};
}
template <class T>
T dotProduct(pair<T, T> a, pair<T, T> b) {
  return a.first * b.first + a.second * b.second;
}
template <class T>
T crossProduct(pair<T, T> a, pair<T, T> b) {
  return a.first * b.second - a.second * b.first;
}
template <class T>
T lengthPow(pair<T, T> a) {
  return a.first * a.first + a.second * a.second;
}
template <class T>
LD length(pair<T, T> a) {
  return sqrt(lengthPow(a));
}
const int N = 1e6 + 57, inf = 1e9 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 7;
const int M = 155;
const long double PI = acos(-1);
const LD EPS = 1e-12;
bitset<N> bylo;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cout << fixed << setprecision(9);
  int a, b;
  cin >> a >> b;
  if (a == 1 && b == 1) {
    cout << "1\n1\n0";
    return 0;
  }
  int ile = 0;
  int i = 1;
  while (a >= i) {
    bylo[i] = 1;
    a -= i;
    ++i;
    ++ile;
  }
  if (a) {
    bylo[i] = 1;
    bylo[i - a] = 0;
  }
  cout << ile << '\n';
  for (int j = 0; j <= i; ++j)
    if (bylo[j]) cout << j << ' ';
  cout << '\n';
  vector<int> res;
  i = 1;
  while (b >= i) {
    if (!bylo[i]) {
      res.push_back(i);
      b -= i;
    }
    ++i;
  }
  cout << res.size() << '\n';
  for (auto u : res) cout << u << ' ';
  cout << '\n';
  return 0;
}
