#include <bits/stdc++.h>
using namespace std;
void solve();
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(10);
  int t = 1;
  while (t--) solve();
  return 0;
}
void solve() {
  int a, b;
  cin >> a >> b;
  vector<int> x, y;
  int s = a + b;
  int t = 0;
  while (t + 1 <= s) {
    s -= t + 1;
    t++;
  }
  for (int i = t + 1 - 1; i >= 1; i--) {
    if (a >= i) {
      x.push_back(i);
      a = a - i;
    } else if (b >= i) {
      y.push_back(i);
      b = b - 1;
    } else
      assert(false);
  }
  cout << x.size() << endl;
  {
    for (auto it : x) cout << it << " ";
    cout << endl;
  };
  cout << y.size() << endl;
  {
    for (auto it : y) cout << it << " ";
    cout << endl;
  };
}
