#include <bits/stdc++.h>
using namespace std;
map<pair<long long, long long>, vector<pair<long long, long long> > > m1;
long long arr[200005];
int main() {
  long long t, i, j, k;
  t = 1;
  while (t--) {
    long long a, b, s = 0;
    cin >> a >> b;
    vector<long long> v;
    for (i = 1; i < a + b + 1; i++) {
      s += i;
      if (s <= a + b) {
        v.push_back(i);
      } else
        break;
    }
    vector<long long> v1, v2;
    long long t1, t2;
    t1 = a;
    long long c = v.size();
    c -= 1;
    long long c1 = 0;
    while (t1 >= 0 && c >= 0) {
      if (t1 - v[c] >= 0) {
        arr[c] = 1;
        t1 -= v[c];
        c1++;
      }
      c--;
    }
    cout << c1 << '\n';
    for (i = 0; i < v.size(); i++) {
      if (arr[i] == 1) cout << v[i] << " ";
    }
    cout << '\n';
    cout << v.size() - c1 << '\n';
    for (i = 0; i < v.size(); i++) {
      if (arr[i] == 0) cout << v[i] << " ";
    }
  }
  return 0;
}
