#include <bits/stdc++.h>
using namespace std;
void write(vector<int> v) {
  cout << int(v.size()) << endl;
  for (int i = 0; i < int(v.size()); i++) {
    if (i > 0) cout << " ";
    cout << v[i];
  }
  cout << endl;
}
long long int a, b;
int main() {
  ios::sync_with_stdio(false);
  cin >> a >> b;
  long long int k = 0;
  while ((k + 1) * (k + 2) / 2 <= a + b) k++;
  vector<int> sola, solb;
  for (int i = k; i >= 1; i--) {
    if (i <= a) {
      sola.push_back(i);
      a -= i;
    } else
      solb.push_back(i);
  }
  write(sola);
  write(solb);
}
