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