#include <bits/stdc++.h>
using namespace std;
int find_lim(long long int s) { return (int)floor(sqrt(1 + 8 * s) / 2 - 0.5); }
int main(int argc, char** argv) {
  long long int a, b;
  cin >> a >> b;
  if (a == 0 && b == 0) {
    cout << "0\n0\n";
    return 0;
  }
  long long int temp1 = a, temp2 = b;
  a = min(temp1, temp2);
  b = max(temp1, temp2);
  int lim = find_lim(a + b);
  if (a == 0) {
    if (temp2) {
      cout << "0\n\n";
    }
    cout << lim << endl;
    for (int i = 1; i <= lim; i++) cout << i << " ";
    cout << endl;
    if (temp1) {
      cout << "0\n\n";
    }
    return 0;
  }
  int last = find_lim(a);
  int first = 1;
  int mid1 = last;
  int mid2 = last;
  int gap = (a - (last * (last + 1) / 2)) % (last - first + 1);
  int inc = (a - (last * (last + 1) / 2)) / (last - first + 1);
  if (gap) {
    mid2 -= (gap - 1);
    mid1 -= gap;
    mid2++;
    last++;
  }
  first += inc;
  mid1 += inc;
  mid2 += inc;
  last += inc;
  vector<int> fd, sd;
  long long int sum = 0;
  for (int i = 1; i <= lim; i++) {
    if ((i >= first && i <= mid1) || (i >= mid2 && i <= last)) {
      fd.push_back(i);
    } else {
      if ((sum + i) <= b) {
        sd.push_back(i);
        sum += i;
      } else if (i > last) {
        break;
      }
    }
  }
  if (temp1 > temp2) {
    cout << sd.size() << endl;
    for (int i = 0; i < sd.size(); i++) {
      cout << sd[i] << " ";
    }
    cout << endl;
    cout << fd.size() << endl;
    for (int i = 0; i < fd.size(); i++) {
      cout << fd[i] << " ";
    }
    cout << endl;
  } else {
    cout << fd.size() << endl;
    for (int i = 0; i < fd.size(); i++) {
      cout << fd[i] << " ";
    }
    cout << endl;
    cout << sd.size() << endl;
    for (int i = 0; i < sd.size(); i++) {
      cout << sd[i] << " ";
    }
    cout << endl;
  }
  return 0;
}
