#include <bits/stdc++.h>
using namespace std;
int a, b;
vector<int> A, B;
int main() {
  scanf("%d%d", &a, &b);
  int n = (int)(sqrt(2ll * (a + b)));
  while (1ll * n * (n + 1) / 2 < (a + b)) ++n;
  while (1ll * n * (n + 1) / 2 > (a + b)) --n;
  for (int i = n; i; --i)
    if (b >= i) {
      b -= i;
      B.push_back(i);
    } else
      A.push_back(i);
  printf("%d\n", A.size());
  for (auto x : A) printf("%d ", x);
  printf("\n%d\n", B.size());
  for (auto x : B) printf("%d ", x);
  printf("\n");
  return 0;
}
