#include <bits/stdc++.h>
using namespace std;
template <class T>
void chmin(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T& a, const T& b) {
  if (a < b) a = b;
}
long long a, b;
int k = 0;
long long imos[90000];
bool used[90000];
int main() {
  cin >> a >> b;
  bool f = (a > b);
  if (a > b) swap(a, b);
  long long l = 0ll, r = 80000ll;
  while (r - l > 1ll) {
    long long mid = (l + r) / 2ll;
    if (mid * (mid + 1ll) / 2ll <= a + b)
      l = mid;
    else
      r = mid;
  }
  k = l;
  for (int i = 1; i <= k; i++) {
    imos[i] = i;
    used[i] = false;
  }
  for (int i = k; i >= 1; i--) imos[i] += imos[i + 1];
  int idx = 1;
  while (imos[idx] > a) idx++;
  vector<int> A, B;
  for (int i = idx; i <= k; i++) {
    A.push_back(i);
    used[i] = true;
  }
  if (a - imos[idx] > 0) {
    A.push_back(a - imos[idx]);
    used[a - imos[idx]] = true;
  }
  for (int i = 1; i <= k; i++) {
    if (!used[i]) B.push_back(i);
  }
  sort((A).begin(), (A).end());
  sort((B).begin(), (B).end());
  if (f) swap(A, B);
  cout << A.size() << endl;
  for (int i = 0; i < (int)A.size(); i++) {
    printf("%d%c", A[i], (i == (int)A.size() - 1) ? '\n' : ' ');
  }
  cout << B.size() << endl;
  for (int i = 0; i < (int)B.size(); i++) {
    printf("%d%c", B[i], (i == (int)B.size() - 1) ? '\n' : ' ');
  }
  return 0;
}
