#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int sum = a + b;
  int tot = 0, k = 0;
  ;
  while (k + tot <= sum) {
    tot += k;
    k++;
  }
  k--;
  vector<int> A, B;
  for (int i = k; i >= 1; i--) {
    if (i <= a) {
      A.push_back(i);
      a -= i;
    } else
      B.push_back(i);
  }
  cout << A.size() << "\n";
  for (int x : A) {
    cout << x << " ";
  }
  cout << "\n";
  cout << B.size() << "\n";
  for (int x : B) {
    cout << x << " ";
  }
  return 0;
}
