#include <bits/stdc++.h>
using namespace std;
vector<int> A, B;
bool ok(int a, int b, int c, bool saveResults) {
  while (c > 0 && a >= 0 && b >= 0) {
    if (a < b) {
      b -= c;
      if (saveResults) B.push_back(c);
    } else {
      a -= c;
      if (saveResults) A.push_back(c);
    }
    --c;
  }
  return (a >= 0 && b >= 0);
}
int binSrch(int a, int b) {
  int l = 0, r = 100010;
  int found = -1;
  while (l <= r) {
    int mid = l + (r - l) / 2;
    if (ok(a, b, mid, false)) {
      found = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  return found;
}
void putVect(vector<int> &v) {
  printf("%d\n", (int)v.size());
  for (const auto &it : v) printf("%d ", it);
  puts("");
}
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  int rez = binSrch(a, b);
  ok(a, b, rez, true);
  putVect(A);
  putVect(B);
  return 0;
}
