#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  int s = a + b;
  int used = 0;
  int k = 1;
  while (used + k <= s) {
    used += k;
    k++;
  }
  k--;
  vector<int> A, B;
  for (int i = k; i >= 1; i--) {
    if (a >= i) {
      a -= i;
      A.push_back(i);
    } else {
      b -= i;
      B.push_back(i);
    }
  }
  cout << A.size() << endl;
  for (auto x : A) cout << x << " ";
  cout << endl;
  cout << B.size() << endl;
  for (auto x : B) cout << x << " ";
  cout << endl;
  return 0;
}
