#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int sum = n + m;
  int a = 0;
  int b = 1;
  while (a + b <= sum) a += b++;
  vector<int> A;
  vector<int> B;
  --b;
  for (int i = b; i >= 1; i--) {
    if (n - i >= 0) {
      A.push_back(i);
      n -= i;
    } else if (m - i >= 0) {
      B.push_back(i);
      m -= i;
    }
  }
  cout << A.size() << "\n";
  for (int i = 0; i < (int)A.size(); i++) cout << A[i] << " ";
  cout << "\n";
  cout << B.size() << "\n";
  for (int i = 0; i < (int)B.size(); i++) cout << B[i] << " ";
  cout << "\n";
  return 0;
}
