#include <bits/stdc++.h>
using namespace std;
vector<int> a, b;
int main() {
  int n, m;
  cin >> n >> m;
  int x = n + m;
  int mx = 1;
  while (1LL * mx * (mx + 1) / 2 <= x) mx++;
  mx--;
  for (int i = mx; i >= 1; i--) {
    if (n >= i) {
      n -= i;
      a.push_back(i);
    } else {
      m -= i;
      b.push_back(i);
    }
  }
  printf("%d\n", (int)a.size());
  for (int i : a) printf("%d ", i);
  puts("");
  printf("%d\n", (int)b.size());
  for (int i : b) printf("%d ", i);
  puts("");
}
