#include <bits/stdc++.h>
using namespace std;
bool Fill(int a, int b, int x, bool print) {
  vector<int> in_a, in_b;
  for (; x > 0; x--) {
    if (x <= a) {
      a -= x;
      if (print) {
        in_a.push_back(x);
      }
      continue;
    }
    if (x <= b) {
      b -= x;
      if (print) {
        in_b.push_back(x);
      }
      continue;
    }
    return false;
  }
  if (print) {
    cout << in_a.size() << "\n";
    for (int i = 0; i < in_a.size(); i++) {
      cout << in_a[i] << " ";
    }
    cout << "\n";
    cout << in_b.size() << "\n";
    for (int i = 0; i < in_b.size(); i++) {
      cout << in_b[i] << " ";
    }
    cout << "\n";
  }
  return true;
}
int main() {
  int a, b;
  cin >> a >> b;
  int start = 0, end = 100000, mid;
  while (start + 1 < end) {
    mid = (start + end) / 2;
    if (Fill(a, b, mid, false)) {
      start = mid;
    } else {
      end = mid - 1;
    }
  }
  if (Fill(a, b, end, false)) {
    Fill(a, b, end, true);
  } else {
    Fill(a, b, start, true);
  }
}
