#include <bits/stdc++.h>
using namespace std;
int main() {
  set<int> e[2];
  set<int>::iterator it;
  long long a, b, x = 0, i;
  cin >> a >> b;
  for (; x * (x + 1) <= (a + b) * 2; x++)
    ;
  for (x--; x; x--) {
    e[x > a].insert(x);
    if (x <= a) a -= x;
  }
  for (i = 0; i < 2; i++) {
    cout << e[i].size() << "\n";
    for (it = e[i].begin(); it != e[i].end(); ++it) cout << *it << ' ';
    cout << endl;
  }
  return 0;
}
