#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2 * 1e5 + 1;
const int INF = 1e9 + 10;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  double m, a, b, k, cnt = 0;
  int n, q;
  cin >> a >> b;
  n = floor((sqrt(8 * (a + b) + 1) - 1) / 2);
  q = n;
  vector<int> used(n + 1, 0);
  int cnt_a = 0, cnt_b = 0;
  while (a >= 1 && n >= 1) {
    if (a >= n && used[n] == 0) {
      a -= n;
      used[n] = 1;
      cnt_a++;
    }
    --n;
  }
  n = q;
  a = b;
  while (a > 0 && n >= 1) {
    if (a >= n && used[n] == 0) {
      a -= n;
      used[n] = 2;
      cnt_b++;
    }
    --n;
  }
  cout << cnt_a << "\n";
  for (int i = 0; i < q + 1; ++i) {
    if (used[i] == 1) {
      cout << i << " ";
    }
  }
  cout << "\n";
  cout << cnt_b << "\n";
  for (int i = 0; i < q + 1; ++i) {
    if (used[i] == 2) {
      cout << i << " ";
    }
  }
  return 0;
}
