#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 9, MOD = 998244353, maxV = 202;
long long a, b;
vector<int> anss;
vector<int> one, two;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> a >> b;
  long long acum = 0;
  for (int i = 1; acum + i <= a + b; i++) {
    anss.push_back(i);
    acum += i;
  }
  for (int i = int(anss.size()) - 1; i >= 0; i--) {
    if (a > 0 && a >= anss[i]) {
      one.push_back(anss[i]);
      a -= anss[i];
    } else {
      two.push_back(anss[i]);
    }
  }
  cout << one.size() << '\n';
  for (int el : one) cout << el << ' ';
  cout << '\n';
  cout << two.size() << '\n';
  for (int el : two) cout << el << ' ';
  cout << '\n';
}
