#include <bits/stdc++.h>
using namespace std;
bool life[1000005];
int main() {
  long long a, b;
  int l, r, mid;
  int ans, cnt = 0;
  scanf("%lld%lld", &a, &b);
  l = 0;
  r = 1000000007;
  while (l != r) {
    mid = (r + l + 1) / 2;
    if (((mid + 1LL) * mid) / 2 > a + b)
      r = mid - 1;
    else
      l = mid;
  }
  ans = l;
  for (int i = l; i > 0; i--) {
    if (a >= i) {
      a -= i;
      life[i] = 1;
      cnt++;
    }
  }
  printf("%d\n", cnt);
  if (cnt) {
    for (int i = 1; i <= l; i++) {
      if (life[i]) printf("%d ", i);
    }
    printf("\n");
  }
  printf("%d\n", ans - cnt);
  if (ans - cnt) {
    for (int i = 1; i <= l; i++) {
      if (!life[i]) printf("%d ", i);
    }
    printf("\n");
  }
  return 0;
}
