#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  long long x;
  long long l = 1;
  long long r = 1e9 + 2;
  while (r - l > 1) {
    long long m = l + (r - l) / 2;
    if ((m * (m + 1)) / 2 <= a + b)
      l = m;
    else
      r = m;
  }
  x = l;
  int used = -1000;
  vector<int> answA;
  vector<int> answB;
  if (a >= x) {
    while (a >= x && x > 0) {
      answA.push_back(x);
      a -= x;
      x--;
    }
    if (a != 0 && a <= x) {
      used = a;
      a = 0;
      answA.push_back(used);
    }
    while ((b >= x || b == used) && x > 0) {
      if (x == used) {
        x--;
        continue;
      }
      answB.push_back(x);
      x--;
    }
  } else if (b >= x) {
    while (b >= x && x > 0) {
      answB.push_back(x);
      b -= x;
      x--;
    }
    if (b != 0 && b <= x) {
      used = b;
      b = 0;
      answB.push_back(used);
    }
    while ((a >= x || x == used) && x > 0) {
      if (x == used) {
        x--;
        continue;
      }
      answA.push_back(x);
      a -= x;
      x--;
    }
  }
  cout << answA.size() << endl;
  for (int i = 0; i < answA.size(); i++) cout << answA[i] << " ";
  cout << endl;
  cout << answB.size() << endl;
  for (int i = 0; i < answB.size(); i++) cout << answB[i] << " ";
  return 0;
}
