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