#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  vector<int> l, r, mass;
  for (long long i = 1; i * (i + 1) / 2 <= (a + b); i++) {
    mass.push_back((int)i);
  }
  for (int i = mass.size() - 1; i >= 0; i--) {
    if (a >= mass[i]) {
      a -= mass[i];
      l.push_back(mass[i]);
    } else
      r.push_back(mass[i]);
  }
  cout << l.size() << endl;
  for (auto c : l) cout << c << " ";
  cout << endl << r.size() << endl;
  for (auto c : r) cout << c << " ";
  return 0;
}
