#include <bits/stdc++.h>
using namespace std;
long long largest(long long len, long long sum);
int main() {
  long long a, b;
  cin >> a >> b;
  int as = 0;
  long long run1 = 0;
  for (int i = 1; run1 + i <= a; ++i) {
    run1 += i;
    ++as;
  }
  set<long long> asol;
  long long rem_sum = a, rem_size = as;
  while (rem_size > 0) {
    long long nxt = largest(rem_size, rem_sum);
    asol.insert(nxt);
    --rem_size;
    rem_sum -= nxt;
  }
  long long run2 = 0;
  vector<long long> bsol;
  for (long long i = 1; run2 + i <= b; ++i) {
    if (!asol.count(i)) {
      bsol.push_back(i);
      run2 += i;
    }
  }
  cout << asol.size() << endl;
  for (auto &x : asol) {
    cout << x << ' ';
  }
  cout << endl;
  cout << bsol.size() << endl;
  for (auto &x : bsol) {
    cout << x << ' ';
  }
  cout << endl;
}
long long largest(long long len, long long sum) {
  long long base_sum = ((len - 1) * len) / 2;
  return (sum - base_sum) / len;
}
