#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long a, b;
  cin >> a >> b;
  long long f = a + b, s = 0, k = 0;
  while (s + k + 1 <= f) {
    k++;
    s += k;
  }
  vector<int> g;
  for (int i = k; i >= 1; i--) {
    g.push_back(i);
  }
  vector<int> sa, sb;
  int ra = a, rb = b;
  for (int i = 0; i < k; i++) {
    if (ra > rb) {
      ra -= g[i];
      sa.push_back(g[i]);
    } else {
      rb -= g[i];
      sb.push_back(g[i]);
    }
  }
  cout << sa.size() << endl;
  for (int va : sa) {
    cout << va << " ";
  }
  cout << endl;
  cout << sb.size() << endl;
  for (int vb : sb) {
    cout << vb << " ";
  }
  cout << endl;
  return 0;
}
