#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  long long k = 1;
  long long l = a + b;
  l += l;
  while (k * k + k <= l) k++;
  k--;
  vector<int> va, vb;
  for (; k >= 1; k--) {
    if (a >= k) {
      a -= k;
      va.push_back(k);
    } else {
      b -= k;
      vb.push_back(k);
    }
  }
  cout << va.size() << endl;
  for (auto iter = va.begin(); iter != va.end(); ++iter) cout << *iter << " ";
  cout << endl << vb.size() << endl;
  for (auto iter = vb.begin(); iter != vb.end(); ++iter) cout << *iter << " ";
  cout << endl;
  return 0;
}
