#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  long long s = a + b, sum = 0, c = 0;
  for (int i = 1; i <= s; i++) {
    sum += i;
    if (sum <= s) {
      c = i;
    } else {
      break;
    }
  }
  vector<int> x, y;
  for (int i = c; i >= 1; i--) {
    if (a >= i) {
      a -= i;
      x.push_back(i);
    } else {
      b -= i;
      y.push_back(i);
    }
  }
  cout << x.size() << endl;
  for (int i = 0; i < x.size(); i++) {
    cout << x[i] << " ";
  }
  cout << endl;
  cout << y.size() << endl;
  for (int i = 0; i < y.size(); i++) {
    cout << y[i] << " ";
  }
  cout << endl;
  return 0;
}
