#include <bits/stdc++.h>
using namespace std;
int a, b;
int main() {
  cin >> a >> b;
  int s = 0, k = 0;
  while (s <= a + b) s += ++k;
  k--;
  vector<int> A, B;
  int ca = a, cb = b;
  bool ans = 0;
  for (int i = k; i >= 1; i--) {
    if (a >= b && a >= i) {
      A.push_back(i);
      a -= i;
    } else if (a < b && b >= i) {
      B.push_back(i);
      b -= i;
    } else {
      ans = 1;
      break;
    }
  }
  if (!ans) {
    cout << A.size() << endl;
    for (int i : A) cout << i << " ";
    cout << endl;
    cout << B.size() << endl;
    for (int i : B) cout << i << " ";
    cout << endl;
    return 0;
  }
  k--;
  A.clear(), B.clear();
  for (int i = k; i >= 1; i--) {
    if (a >= b && a >= i) {
      A.push_back(i);
      a -= i;
    } else if (a < b && b >= i) {
      B.push_back(i);
      b -= i;
    } else {
      assert(0);
    }
  }
  cout << A.size() << endl;
  for (int i : A) cout << i << " ";
  cout << endl;
  cout << B.size() << endl;
  for (int i : B) cout << i << " ";
  cout << endl;
  return 0;
}
