#include <bits/stdc++.h>
using namespace std;
long long a, b;
bool flag = false;
map<long long, bool> used;
vector<long long> ansa, ansb;
int main() {
  cin >> a >> b;
  if (a > b) {
    flag = true;
    swap(a, b);
  }
  long long ka = 1, kb = 1;
  while (true) {
    if (a - ka < 0) {
      long long c = ansa.size() - 1;
      while (a--) {
        ansa[c--]++;
      }
      break;
    } else {
      ansa.push_back(ka);
      a -= ka;
      ka++;
    }
  }
  for (auto i : ansa) used[i] = true;
  while (true) {
    if (used[kb]) {
      kb++;
      continue;
    }
    if (b - kb < 0) {
      break;
    } else {
      ansb.push_back(kb);
      b -= kb;
      kb++;
    }
  }
  if (ansb.size() > 0) ansb[ansb.size() - 1] += b;
  if (!flag) {
    cout << ansa.size() << endl;
    for (auto i : ansa) cout << i << " ";
    cout << endl << ansb.size() << endl;
    for (auto i : ansb) cout << i << " ";
  } else {
    cout << ansb.size() << endl;
    for (auto i : ansb) cout << i << " ";
    cout << endl << ansa.size() << endl;
    for (auto i : ansa) cout << i << " ";
  }
}
