#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  if (n == 0 && m == 0) {
    cout << 0 << endl;
    cout << " " << endl;
    cout << 0 << endl;
    cout << " " << endl;
    return 0;
  }
  long long x;
  for (long long i = 1; i <= 10000000; i++) {
    if ((i * (i + 1)) / 2 <= n + m) {
      x = i;
      continue;
    } else {
      break;
    }
  }
  vector<long long> first;
  vector<long long> second;
  bool used[x];
  fill(used + 1, used + x + 1, false);
  for (long long i = x; i >= 1; i--) {
    if (i <= n) {
      first.push_back(i);
      n -= i;
      used[i] = true;
    }
  }
  for (long long i = x; i >= 1; i--) {
    if (!used[i]) {
      second.push_back(i);
    }
  }
  cout << first.size() << endl;
  for (long long i = 0; i < first.size(); i++) {
    cout << first[i] << " ";
  }
  cout << endl;
  cout << second.size() << endl;
  for (long long i = 0; i < second.size(); i++) {
    cout << second[i] << " ";
  }
}
