#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long a, b;
  cin >> a >> b;
  long long n = a + b;
  long long k = 1;
  long long used = 0;
  while (used + k <= n) {
    used += k;
    k++;
  }
  k--;
  vector<long long> aa, ba;
  for (long long i = k; i >= 1; i--) {
    if (i <= a) {
      a -= i;
      aa.push_back(i);
    } else {
      assert(b >= i);
      b -= i;
      ba.push_back(i);
    }
    n = a + b;
  }
  cout << aa.size() << endl;
  for (long long i : aa) cout << i << ' ';
  cout << "\n";
  cout << ba.size() << endl;
  for (long long i : ba) cout << i << ' ';
  cout << "\n";
}
signed main() {
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
