#include <bits/stdc++.h>
#pragma comment(linker, "/STACK: 40000000")
using namespace std;
void fail() {
  cout << "false" << endl;
  exit(0);
}
string binstr(long long int v, long long int len) {
  string res = "";
  for (long long int i = 0; i < len; i++, v >>= 1) {
    res = ((v & 1) ? "1" : "0") + res;
  }
  return res;
}
void solve() {
  long long int limits[2];
  cin >> limits[0] >> limits[1];
  long long int selected = ((limits[0] < limits[1]) ? 0 : 1);
  long long int paper_amount = 0;
  vector<long long int> days[2];
  while ((paper_amount + 2) * (paper_amount + 1) / 2 <= limits[0] + limits[1])
    paper_amount++;
  for (long long int paper = paper_amount; paper > 0; paper--) {
    if (limits[selected] >= paper) {
      days[selected].push_back(paper);
      limits[selected] -= paper;
    } else {
      days[selected ^ 1].push_back(paper);
      limits[selected ^ 1] -= paper;
    }
  }
  for (long long int i = 0; i < 2; i++) {
    reverse(days[i].begin(), days[i].end());
    cout << days[i].size() << endl;
    for (auto paper : days[i]) cout << paper << ' ';
    cout << endl;
  }
}
int main() {
  cin.sync_with_stdio(false);
  solve();
  return 0;
}
