#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long a, b;
  cin >> a >> b;
  set<long long> aset, bset;
  long long na = 0;
  long long sum = 0;
  for (long long i = 1; sum < a; ++i) {
    aset.insert(i);
    sum += i;
    na = i;
  }
  aset.erase(sum - a);
  if (sum != a && (sum - a) <= b) {
    bset.insert(sum - a);
  }
  sum = sum - a;
  for (long long i = na + 1; sum <= b; ++i) {
    if (sum + i > b) {
      break;
    }
    bset.insert(i);
    sum += i;
  }
  cout << aset.size() << endl;
  for (auto &i : aset) {
    cout << i << " ";
  }
  cout << endl;
  cout << bset.size() << endl;
  for (auto &i : bset) {
    cout << i << " ";
  }
  cout << endl;
  return 0;
}
