#include <bits/stdc++.h>
using namespace std;
long long a, b;
int main() {
  cin >> a >> b;
  long long s = a + b;
  long long i;
  long long total = 0;
  long long up = 0;
  for (i = 0;; i++) {
    total += i;
    if (total > s) {
      up = i - 1;
      break;
    }
  }
  set<long long> one, two;
  set<long long>::iterator ii;
  for (i = up; i >= 1; i--) {
    if (i <= a) {
      a -= i;
      one.insert(i);
    }
  }
  cout << one.size() << endl;
  for (ii = one.begin(); ii != one.end(); ii++) {
    cout << (*ii) << " ";
  }
  cout << endl;
  long long w = one.size();
  cout << (up - w) << endl;
  for (i = 1; i <= up; i++) {
    if (one.find(i) == one.end()) {
      cout << i << " ";
    }
  }
  return 0;
}
