#include <bits/stdc++.h>
using namespace std;
int a, b;
vector<int> va, vb;
void print(vector<int> &v) {
  printf("%d\n", static_cast<int>(v.size()));
  for (auto i : v) printf("%d ", i);
  puts("");
}
int main() {
  scanf("%d%d", &a, &b);
  int up = 0, sum = 0;
  for (int i = 0; sum + up < a + b; i++) {
    sum += i;
    up = i;
  }
  for (int i = up; i > 0; i--) {
    if (a >= i) {
      a -= i;
      va.push_back(i);
    } else {
      b -= i;
      vb.push_back(i);
    }
  }
  print(va);
  print(vb);
}
