#include <bits/stdc++.h>
using namespace std;
vector<int> va, vb;
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  int s = 0, m = 0;
  for (int i = 1; s + i <= a + b; i++) {
    s += i;
    m = i;
  }
  for (int i = m; i > 0; i--) {
    if (a >= i) {
      a -= i;
      va.push_back(i);
    } else {
      vb.push_back(i);
    }
  }
  printf("%d\n", (int)va.size());
  for (int x : va) printf("%d ", x);
  printf("\n");
  printf("%d\n", (int)vb.size());
  for (int x : vb) printf("%d ", x);
  printf("\n");
  return 0;
}
