#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
long long a, b;
vector<int> F, S;
char f(long long k) {
  F.clear(), S.clear();
  long long x = a, y = b;
  for (; k; --k) {
    if (max(x, y) < k) return 0;
    if (x < y && x >= k)
      F.push_back(k), x -= k;
    else if (y <= x && y >= k)
      S.push_back(k), y -= k;
    else if (x > y)
      F.push_back(k), x -= k;
    else
      S.push_back(k), y -= k;
  }
  return 1;
}
int main() {
  cin >> a >> b;
  int l = 0, r = 1e5;
  while (l < r) {
    int m = (l + r) >> 1;
    if (f(m))
      l = m + 1;
    else
      r = m;
  }
  f(--l);
  cout << F.size() << endl;
  for (int i : F) cout << i << " ";
  cout << endl << S.size() << endl;
  for (int i : S) cout << i << " ";
  cout << endl;
}
