#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
template <class T>
T gcd(T a, T b) {
  return ((b == 0) ? a : gcd(b, a % b));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long a, b;
  int f = 0;
  cin >> a >> b;
  if (b < a) f = 1, swap(a, b);
  long long l = 0, r = 100000;
  while (l < r) {
    long long mid = (l + r + 1) / 2;
    if (((mid * (mid + 1)) / 2) <= (a + b))
      l = mid;
    else
      r = mid - 1;
  }
  long long tot = 0LL;
  long long cur = 1LL;
  vector<long long> d, h;
  while ((tot + cur) <= a) {
    d.push_back(cur);
    tot += cur;
    cur++;
  }
  long long dif = a - tot;
  for (int i = 0; i < (int)(d.size()); i++) d[i] += dif / (long long)(d.size());
  dif %= (long long)d.size();
  for (int i = (int)(d.size()) - 1; i >= 0; i--) {
    if (!dif) break;
    dif--;
    d[i]++;
    assert(d[i] <= l);
  }
  vector<int> vis(l + 1, 0);
  for (int i = 0; i < (int)(d.size()); i++) vis[d[i]] = 1;
  for (int i = (int)(1); i < (int)(l + 1); i++)
    if (!vis[i]) h.push_back(i);
  if (f) {
    cout << (int)h.size() << endl;
    for (long long x : h) cout << x << " ", vis[x] = 1;
    cout << endl;
    cout << (int)d.size() << endl;
    for (long long x : d) cout << x << " ";
    cout << endl;
  } else {
    cout << (int)d.size() << endl;
    for (long long x : d) cout << x << " ";
    cout << endl;
    cout << (int)h.size() << endl;
    for (long long x : h) cout << x << " ", vis[x] = 1;
    cout << endl;
  }
  return 0;
}
