#include <bits/stdc++.h>
using namespace std;
bool x[100005] = {0}, y[100005] = {0}, z[100005];
long long ans1 = 0, ans2 = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long a, b;
  cin >> a >> b;
  long long ans;
  long long s = sqrt(2 * (a + b));
  if (s * (s + 1) / 2 <= (a + b))
    ans = s;
  else
    ans = s - 1;
  for (int i = ans; i >= 1; i--) {
    if (a >= i && z[i] != true) {
      z[i] = true;
      x[i] = true;
      a -= i;
      ans1++;
    }
  }
  for (int i = ans; i >= 1; i--) {
    if (b >= i && z[i] != true) {
      z[i] = true;
      y[i] = true;
      b -= i;
      ans2++;
    }
  }
  cout << ans1 << '\n';
  for (int i = 1; i <= ans; i++) {
    if (x[i]) cout << i << ' ';
  }
  cout << '\n';
  cout << ans2 << '\n';
  for (int i = 1; i <= ans; i++) {
    if (y[i]) cout << i << ' ';
  }
}
