#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  long long sum = a + b;
  long long n = 1;
  while (n * (n + 1) / 2 <= sum) {
    n += 1;
  }
  n -= 1;
  vector<long long> p, q;
  while (n > 0) {
    if (a >= n) {
      p.push_back(n);
      a -= n;
    } else {
      q.push_back(n);
      b -= n;
    }
    n--;
  }
  cout << p.size() << '\n';
  for (auto pp : p) {
    cout << pp << ' ';
  }
  cout << '\n' << q.size() << '\n';
  for (auto qq : q) {
    cout << qq << ' ';
  }
  cout << endl;
  return 0;
}
