#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
signed main() {
  long long q = 1;
  while (q--) {
    long long a, b;
    cin >> a >> b;
    long long turn = 0;
    if (b < a) {
      swap(a, b);
      turn = 1;
    }
    long long num = a + b;
    long long large = (sqrt(1 + 8 * num) - 1) / 2;
    vector<long long> a1;
    vector<long long> a2;
    map<long long, long long> c;
    long long sum = 0;
    num = 1;
    if (a != 0) {
      if (a <= large) {
        a1.push_back(a);
        c[a] = 1;
      } else {
        num = large;
        a1.push_back(num);
        sum += num;
        c[num] = 1;
        while (sum <= a) {
          if (a - sum <= large && c[a - sum] == 0) {
            c[a - sum] = 1;
            a1.push_back(a - sum);
            break;
          }
          num--;
          sum += num;
          if (sum > a) break;
          a1.push_back(num);
          c[num] = 1;
        }
      }
    }
    sum = 0;
    for (long long i = 1; i <= large; i++) {
      if (c[i] == 0) {
        sum += i;
        a2.push_back(i);
      }
    }
    if (turn == 0) {
      cout << a1.size() << endl;
      for (long long i = 0; i < a1.size(); i++) cout << a1[i] << " ";
      cout << endl;
      cout << a2.size() << endl;
      for (long long i = 0; i < a2.size(); i++) cout << a2[i] << " ";
    } else {
      cout << a2.size() << endl;
      for (long long i = 0; i < a2.size(); i++) cout << a2[i] << " ";
      cout << endl;
      cout << a1.size() << endl;
      for (long long i = 0; i < a1.size(); i++) cout << a1[i] << " ";
    }
  }
}
