#include <bits/stdc++.h>
using namespace std;
int a, b;
vector<int> f, g;
int main() {
  scanf("%d%d", &a, &b);
  int s = a + b, t, sz;
  for (t = sz = 1; sz <= s; t++, sz += t)
    ;
  if (sz > s) t--;
  for (int i = t; i >= 1; i--) {
    if (a >= i)
      a -= i, f.push_back(i);
    else if (b >= i)
      b -= i, g.push_back(i);
  }
  printf("%d\n", f.size());
  for (int i = 0; i < f.size(); i++) printf("%d ", f[i]);
  puts("");
  printf("%d\n", g.size());
  for (int i = 0; i < g.size(); i++) printf("%d ", g[i]);
  puts("");
  return 0;
}
