#include <bits/stdc++.h>
using namespace std;
long long a, b;
vector<int> q, w;
int main() {
  scanf("%lld %lld", &a, &b);
  long long last = 0;
  while (last * (last + 1) / 2 <= a + b) last++;
  last--;
  for (int i = last; i > 0; i--) {
    if (i <= a) {
      q.push_back(i);
      a -= i;
    } else if (i <= b) {
      w.push_back(i);
      b -= i;
    }
  }
  printf("%d\n", int(q.size()));
  for (int x : q) printf("%d ", x);
  printf("\n");
  printf("%d\n", int(w.size()));
  for (int x : w) printf("%d ", x);
  printf("\n");
}
