#include <bits/stdc++.h>
using namespace std;
long long cnt = 0, i, v, sum = 0, l = 1, r, mid, a, b, x[100005], y[100005],
          pre;
int main() {
  scanf("%I64d%I64d", &a, &b);
  l = 1;
  r = 100000;
  while (l < r) {
    mid = (l + r) / 2;
    if ((1LL + mid) * mid / 2 <= a + b)
      l = mid + 1;
    else
      r = mid;
  }
  l--;
  cnt = 0;
  sum = a;
  for (i = 1; i <= l; i++) {
    if (sum >= i) {
      sum -= i;
      x[++cnt] = i;
    } else {
      if (sum == 0)
        break;
      else {
        x[i - sum] = 0;
        pre = i - sum;
        x[++cnt] = i;
        i++;
        cnt--;
        break;
      }
    }
  }
  v = i;
  printf("%d\n", cnt);
  for (i = 1; i <= cnt + 3; i++) {
    if (x[i]) printf("%d ", x[i]);
  }
  printf("\n");
  printf("%d\n", l - cnt);
  for (i = v; i <= l; i++) printf("%d ", i);
  if (pre) printf("%d ", pre);
  printf("\n");
  return 0;
}
