#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, n, s;
  cin >> a >> b;
  s = a + b;
  n = (-1 + sqrt(1 + 8 * s)) / 2;
  set<long long> A;
  for (int i = n; i >= 1; i--) {
    if (i <= a) {
      A.insert(i);
      a -= i;
    }
  }
  cout << A.size() << '\n';
  for (auto x : A) {
    cout << x << " ";
  }
  cout << '\n' << n - A.size() << '\n';
  for (int i = 1; i <= n; i++) {
    if (A.find(i) == A.end()) cout << i << " ";
  }
  cout << '\n';
  return 0;
}
