#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
  out << '(' << p.first << ", " << p.second << ')';
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
  int l = v.size();
  for (int i = 0; i < l - 1; i++) out << v[i] << ' ';
  if (l > 0) out << v[l - 1];
  return out;
}
template <typename T>
void trace(const char* name, T&& arg1) {
  cout << name << " : " << arg1 << endl;
}
template <typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  trace(comma + 1, args...);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long a, b;
  bool f = 0;
  cin >> a >> b;
  vector<long long> d1, d2;
  if (b > a) {
    long long t = b;
    b = a;
    a = t;
    f = 1;
  }
  long long s = a + b, x;
  for (x = 1;; x++) {
    if (x * (x + 1) / 2 > s) break;
  }
  x--;
  for (int i = x; i >= 1; i--) {
    if (i <= a) {
      d1.push_back(i);
      a -= i;
    } else if (i <= b) {
      d2.push_back(i);
      b -= i;
    }
  }
  if (!f) {
    cout << d1.size() << endl;
    for (auto e : d1) cout << e << " ";
    cout << endl;
    cout << d2.size() << endl;
    for (auto e : d2) cout << e << " ";
    cout << endl;
  } else {
    cout << d2.size() << endl;
    for (auto e : d2) cout << e << " ";
    cout << endl;
    cout << d1.size() << endl;
    for (auto e : d1) cout << e << " ";
    cout << endl;
  }
}
