#include <bits/stdc++.h>
using namespace std;
const long long MXN = 3e5 + 10;
long long a, b, n, m, s, k;
vector<long long> ANS[2];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> a >> b, s = a + b;
  k = 1;
  while (k * (k + 1) / 2 <= s) k++;
  k--;
  for (int i = k; i >= 1; i--) {
    if (a >= i) {
      a -= i;
      ANS[0].push_back(i), n++;
    } else {
      assert(b >= i);
      b -= i;
      ANS[1].push_back(i), m++;
    }
  }
  cout << n << '\n';
  for (auto X : ANS[0]) cout << X << ' ';
  cout << '\n';
  cout << m << '\n';
  for (auto X : ANS[1]) cout << X << ' ';
  cout << '\n';
  return 0;
}
