#include <bits/stdc++.h>
using namespace std;
bool fg[200000];
int n, m, tem, maxn, cntn;
int main() {
  memset(fg, 0, sizeof(fg));
  scanf("%d%d", &n, &m);
  for (long long i = 1;; ++i) {
    if (i * (i + 1) / 2 > n + m) break;
    maxn = i;
  }
  tem = maxn;
  while (n > 0) {
    if (tem == 0) break;
    if (n >= tem) {
      n -= tem;
      fg[tem] = 1;
      cntn++;
    }
    tem--;
  }
  printf("%d\n", cntn);
  int cc = 0;
  for (int i = 1; i <= maxn; ++i) {
    if (fg[i]) {
      cc++;
      if (cc == 1)
        printf("%d", i);
      else
        printf(" %d", i);
    }
  }
  printf("\n");
  printf("%d\n", maxn - cntn);
  cc = 0;
  for (int i = 1; i <= maxn; ++i) {
    if (!fg[i]) {
      cc++;
      if (cc == 1)
        printf("%d", i);
      else
        printf(" %d", i);
    }
  }
}
