#include <bits/stdc++.h>
using namespace std;
const long long MAXN = +100500;
const long long INF = 1e9;
bool ans[MAXN];
long long get(long long x) {
  long long l = 0, r = INF;
  while (l + 1 < r) {
    long long m = (l + r) / 2;
    if (m * (m + 1) / 2 <= x) {
      l = m;
    } else {
      r = m;
    }
  }
  return l;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long a, b;
  cin >> a >> b;
  long long cnt = 0;
  long long up = get(a + b);
  for (long long i = up; i > 0; --i) {
    if (a >= i) {
      a -= i;
      ans[i] = 1;
      cnt++;
    }
  }
  cout << cnt << "\n";
  for (long long i = 1; i <= up; ++i) {
    if (ans[i]) {
      cout << i << " ";
    }
  }
  cout << "\n" << up - cnt << "\n";
  for (long long i = 1; i <= up; ++i) {
    if (!ans[i]) {
      cout << i << " ";
    }
  }
  cout << "\n";
  return 0;
}
