#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long a, b;
vector<long long> p;
vector<long long> q;
long long tot;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> a >> b;
  tot = 1;
  while (1) {
    if (tot * (tot + 1) / 2 <= a + b)
      tot++;
    else {
      tot--;
      break;
    }
  }
  long long rem = a;
  for (int i = tot; i >= 1; i--) {
    if (rem >= i) {
      p.push_back(i);
      rem -= i;
    } else
      q.push_back(i);
  }
  cout << p.size() << endl;
  for (int i = 0; i < int(p.size()); i++) cout << p[i] << " ";
  cout << endl;
  cout << q.size() << endl;
  for (int i = 0; i < int(q.size()); i++) cout << q[i] << " ";
  cout << endl;
}
