#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  vector<long long> f, s;
  long long sm1 = 0, sm2 = 0;
  long long sr = 0;
  for (long long x = 1; x <= 1000000; x++) {
    if ((x * (x + 1)) / 2 <= (a + b)) {
      sr = x;
    } else {
      break;
    }
  }
  for (long long i = sr; i >= 1; i--) {
    if (sm1 + i <= a) {
      sm1 += i;
      f.push_back(i);
    } else if (sm2 + i <= b) {
      sm2 += i;
      s.push_back(i);
    }
  }
  cout << f.size() << endl;
  for (auto x : f) {
    cout << x << " ";
  }
  cout << endl;
  cout << s.size() << endl;
  for (auto x : s) {
    cout << x << " ";
  }
}
