#include <bits/stdc++.h>
using namespace std;
const long long N = 105 + 5, mod = 1e9 + 7;
long long n, x, a, t, mx, k, ans, u, v, b, i, j;
bool bo;
vector<long long> vb, va;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> a >> b;
  while (((x + 1) * (x + 2)) / 2 <= (a + b)) x++;
  while (x) {
    if (x <= a)
      va.push_back(x), a -= x;
    else
      vb.push_back(x);
    x--;
  }
  cout << (n = va.size()) << endl;
  for (long long i = 0; i < n; i++) {
    cout << va[i] << " ";
  }
  cout << endl << (n = vb.size()) << endl;
  for (long long i = 0; i < n; i++) {
    cout << vb[i] << " ";
  }
}
