#include <bits/stdc++.h>
using namespace std;
long long PI = acos(-1.0), MOD = 1000000007;
long long n, m, x, y, z, k, sol, sum, ans, l, r, xx, yy, t;
long long a[1000000], b[1000000], mem[1000][1000];
vector<long long> v;
vector<long long> v1;
vector<long long> n2;
vector<long long> m2;
vector<pair<long long, long long> > vp;
map<long long, long long> ma;
string s1, s2, s;
set<long long> st;
char c;
int main() {
  cin >> x >> y;
  sum = x + y;
  n = x, m = y;
  if (x < y) swap(x, y);
  xx = x, yy = y;
  if (sum == 0) {
    cout << "0 0" << endl;
    return 0;
  }
  v1.push_back(1);
  for (long long i = 1; v1.back() <= sum; i++) {
    v.push_back(i);
    if (i > 1) v1.push_back(i + v1.back());
  }
  v.pop_back();
  v1.pop_back();
  for (int i = v.size() - 1; i >= 0 && x; i--) {
    if (x >= v[i] && v[i]) {
      x -= v[i];
      n2.push_back(v[i]);
      v[i] = 0;
    }
  }
  for (int i = v.size() - 1; i >= 0 && y; i--) {
    if (y >= v[i] && v[i]) {
      y -= v[i];
      m2.push_back(v[i]);
      v[i] = 0;
    }
  }
  if (n == xx) {
    cout << n2.size() << endl;
    for (int i = 0; i < n2.size(); i++) cout << n2[i] << " ";
    cout << endl;
    cout << m2.size() << endl;
    for (int i = 0; i < m2.size(); i++) cout << m2[i] << " ";
    cout << endl;
  } else {
    cout << m2.size() << endl;
    for (int i = 0; i < m2.size(); i++) cout << m2[i] << " ";
    cout << endl;
    cout << n2.size() << endl;
    for (int i = 0; i < n2.size(); i++) cout << n2[i] << " ";
    cout << endl;
  }
  return 0;
}
