#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 10, inf = 1e9 + 10;
long long a, b, x;
vector<long long> v;
int32_t main() {
  scanf("%lld%lld", &a, &b);
  long long t = 0, tt = 0;
  while (tt <= a + b) {
    t++;
    tt += t;
  }
  t--;
  long long sum = 0, pos = t;
  while (sum < a && pos > 0) {
    v.push_back(min(pos, a - sum));
    sum += min(pos, a - sum);
    pos--;
    x++;
  }
  reverse(v.begin(), v.end());
  printf("%lld\n", x);
  for (long long c : v) {
    printf("%lld ", c);
  }
  printf("\n");
  printf("%lld\n", t - x);
  pos = 0;
  for (long long i = 1; i < t + 1; i++) {
    if (pos < x && v[pos] < i) {
      pos++;
    }
    if (pos >= x || v[pos] != i) {
      printf("%lld ", i);
    }
  }
  printf("\n");
}
