#include <bits/stdc++.h>
using namespace std;
vector<long long> A, B;
int main() {
  long long a, b;
  cin >> a >> b;
  long long len = sqrt((a + b) * 2);
  while (len * (len + 1) > (a + b) * 2) len--;
  for (long long pos = len; pos; pos--) {
    if (a >= pos) {
      a -= pos;
      A.push_back(pos);
    } else if (b >= pos) {
      B.push_back(pos);
      b -= pos;
    }
  }
  printf("%d\n", A.size());
  for (auto &t : A) {
    printf("%lld ", t);
  }
  putchar('\n');
  printf("%d\n", B.size());
  for (auto &t : B) {
    printf("%lld ", t);
  }
  putchar('\n');
  return 0;
}
