#include <bits/stdc++.h>
using namespace std;
void print(vector<int> ans) {
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  cout << endl;
}
int main() {
  int a, b;
  cin >> a >> b;
  int used = 0;
  int k = 1;
  int sum = a + b;
  while (used + k <= sum) {
    used = used + k;
    k++;
  }
  k = k - 1;
  vector<int> A, B;
  for (int i = k; i >= 1; i--) {
    if (i <= a) {
      A.push_back(i);
      a = a - i;
    } else {
      B.push_back(i);
      assert(b >= i);
      b = b - i;
    }
  }
  print(A);
  print(B);
}
