#include <bits/stdc++.h>
using namespace std;
long long int solve(long long int a, long long int b) {
  long long int x = sqrt(8 * (a + b) + 1) - 1;
  return x / 2;
}
int main() {
  long long int a, b;
  cin >> a >> b;
  long long int x = solve(a, b);
  vector<long long int> w1, w2;
  for (long long int i = x; i > 0; i--) {
    if (a >= i) {
      a -= i;
      w1.push_back(i);
    } else {
      b -= i;
      w2.push_back(i);
    }
  }
  cout << w1.size() << endl;
  for (int i = 0; i < w1.size(); i++) cout << w1[i] << " ";
  cout << endl;
  cout << w2.size() << endl;
  for (int i = 0; i < w2.size(); i++) cout << w2[i] << " ";
  return 0;
}
