#include <bits/stdc++.h>
using namespace std;
long long a, b;
long long l = 1, r = (int)1e6;
long long sum, indx = 1;
vector<int> fir, sec;
int main() {
  cin >> a >> b;
  sum = a + b;
  while (r - l > 1) {
    long long mid = (l + r) >> 1;
    if (mid * (mid + 1) / 2 <= sum) {
      l = mid;
    } else {
      r = mid;
    }
  }
  indx = l;
  for (int i = indx; i >= 1; i--) {
    if (i <= a) {
      a -= i;
      fir.push_back(i);
    } else if (i <= b) {
      b -= i;
      sec.push_back(i);
    }
  }
  cout << fir.size() << endl;
  for (int i = 0; i < fir.size(); i++) {
    cout << fir[i] << " ";
  }
  cout << endl;
  cout << sec.size();
  cout << endl;
  for (int i = 0; i < sec.size(); i++) {
    cout << sec[i] << " ";
  }
  return 0;
}
