#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  srand(time(NULL));
  int a, b;
  cin >> a >> b;
  int n = a + b;
  vector<int> A, B;
  int sa = 0;
  int ca = 0, cb = 0;
  for (int i = 1; i <= a + b; i++) {
    if (sa + i > a + b) break;
    sa += i;
    ca++;
    A.push_back(i);
  }
  int sb = 0;
  for (int i = int(A.size()) - 1; i >= 0; i--) {
    if (sa <= a) break;
    if (sb + A[i] <= b) {
      sb += A[i];
      sa -= A[i];
      B.push_back(A[i]);
      A[i] = 0;
      ca--;
      cb++;
    }
  }
  cout << ca << "\n";
  for (auto x : A)
    if (x) cout << x << ' ';
  if (ca) cout << "\n";
  cout << cb << "\n";
  for (auto x : B) cout << x << ' ';
  cout << "\n";
}
