#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  int z = 0;
  vector<int> ansa, ansb;
  if (a > b) {
    z = 1;
    swap(a, b);
  }
  int x = 0, y = 0, o = 1;
  while (a - x >= o) {
    x += o;
    o++;
  }
  int c = a - x;
  y += o - c;
  for (int i = 1; i <= o; i++) {
    if (i != y) {
      ansa.push_back(i);
    }
  }
  if (y <= b) {
    ansb.push_back(y);
  }
  o++;
  while (b - y >= o) {
    ansb.push_back(o);
    y += o;
    o++;
  }
  if (z) {
    swap(ansa, ansb);
  }
  cout << ansa.size() << endl;
  for (int i = 0; i < ansa.size(); i++) {
    cout << ansa[i] << " ";
  }
  cout << endl;
  cout << ansb.size() << endl;
  for (int i = 0; i < ansb.size(); i++) {
    cout << ansb[i] << " ";
  }
  return 0;
}
