#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a, b;
int tot1, tot2, use[N], x[N], y[N];
int main() {
  cin >> a >> b;
  long long n = 1;
  while (n * (n + 1) / 2 <= a + b) ++n;
  --n;
  for (int i = n; i >= 1; --i) {
    if (i <= a) use[i] = 1, x[++tot1] = i, a -= i;
  }
  for (int i = n; i >= 1; --i) {
    if (!use[i])
      if (i <= b) use[i] = 1, y[++tot2] = i, b -= i;
  }
  cout << tot1 << endl;
  for (int i = 1; i <= tot1; ++i) printf("%d ", x[i]);
  puts("");
  cout << tot2 << endl;
  for (int i = 1; i <= tot2; ++i) printf("%d ", y[i]);
  puts("");
  return 0;
}
