#include <bits/stdc++.h>
using namespace std;
const int MAX = 200000;
int a, b;
int ansA[MAX];
int cntA, cntB;
int ansB[MAX];
bool can(int x) {
  int A = a, B = b;
  cntA = cntB = 0;
  for (int i = x; i >= 1; --i) {
    if (i <= A) {
      A -= i;
      ansA[cntA++] = i;
    } else if (i <= B) {
      B -= i;
      ansB[cntB++] = i;
    } else {
      return false;
    }
  }
  return true;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> a >> b;
  int l = 0, r = MAX;
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (can(m)) {
      l = m;
    } else {
      r = m - 1;
    }
  }
  if (can(r)) l = r;
  int ans = l;
  if (can(ans)) {
    cout << cntA << "\n";
    for (int i = 0; i < cntA; ++i) {
      cout << ansA[i] << " ";
    }
    cout << "\n";
    cout << cntB << "\n";
    for (int i = 0; i < cntB; ++i) {
      cout << ansB[i] << " ";
    }
    cout << "\n";
  } else {
    assert(false);
  }
}
