#include <bits/stdc++.h>
char output[1 << 26], *buf = output;
void print(register int x) {
  static char stk[10];
  register char *p = stk;
  while (*p++ = x % 10 + '0', x /= 10)
    ;
  while ((*buf++ = (*--p)), p != stk)
    ;
}
int main() {
  int a, b, n, sep, i, remain = 0;
  long long sum = 0;
  scanf("%d%d", &a, &b);
  for (n = 1;; ++n) {
    sum += n;
    if (sum - n <= a && sum > a) sep = n, remain = sum - a;
    if (sum > a + b) break;
  }
  --n;
  print(sep - 1);
  (*buf++ = ('\n'));
  for (i = 1; i <= sep; ++i)
    if (i != remain) print(i), (*buf++ = (' '));
  (*buf++ = ('\n'));
  print(n - sep + 1);
  (*buf++ = ('\n'));
  if (remain <= b) print(remain), (*buf++ = (' '));
  for (i = sep + 1; i <= n; ++i) print(i), (*buf++ = (' '));
  (*buf++ = ('\n'));
  fwrite(output, 1, buf - output, stdout);
  return 0;
}
