#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int a, b;
void outV(vector<int> a) {
  cout << a.size() << "\n";
  for (int x : a) {
    cout << x << " ";
  }
  cout << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  cin >> a >> b;
  int sum = a + b;
  int num = 1;
  int s = 0;
  while (s + num <= sum) {
    s += num;
    ++num;
  }
  --num;
  vector<int> A;
  vector<int> B;
  for (int i = num; i >= 1; --i) {
    if (i <= a)
      A.push_back(i), a -= i;
    else
      B.push_back(i), b -= i;
  }
  outV(A);
  outV(B);
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
