#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  vector<int> aa, bb;
  scanf("%d%d", &a, &b);
  long long lo = 0, hi = 1e9, mid;
  while (lo < hi) {
    mid = lo + (hi - lo + 1) / 2;
    if (mid * (mid + 1) / 2 <= a + b) {
      lo = mid;
    } else {
      hi = mid - 1;
    }
  }
  bool is = 0;
  long long sum = 0;
  for (int i = lo; i >= 1; i--) {
    if (sum + i <= a) {
      aa.push_back(i);
      sum += i;
    } else {
      bb.push_back(i);
    }
  }
  printf("%d\n", aa.size());
  for (auto i : aa) printf("%d ", i);
  puts("");
  printf("%d\n", bb.size());
  for (auto i : bb) printf("%d ", i);
  return 0;
}
