#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  if (a == b && a == 0) {
    printf("0\n");
    printf("0");
    return 0;
  }
  long long x = 0;
  while (x * (x + 1) / 2 <= a + b) {
    x++;
  }
  x--;
  vector<bool> used(x + 1, false);
  vector<int> ans1, ans2;
  bool f = true;
  for (long long i = x; i >= 1; i--) {
    if (a == 0) break;
    if (a > i) {
      a -= i;
      ans1.push_back(i);
      used[i] = true;
    } else {
      ans1.push_back(a);
      used[a] = true;
      break;
    }
  }
  if (b != 0) {
    for (long long i = x; i >= 1; i--) {
      if (!used[i]) ans2.push_back(i);
    }
  }
  printf("%d\n", ans1.size());
  for (int i = 0; i < ans1.size(); i++) printf("%d ", ans1[i]);
  printf("\n");
  printf("%d\n", ans2.size());
  for (int i = 0; i < ans2.size(); i++) printf("%d ", ans2[i]);
}
