#include <bits/stdc++.h>
using namespace std;
long long kol, w, h, k, ra[100005], rb[100005], ma, mb, a1, j, x, c[100005], a,
    b, i;
int main() {
  cin >> a >> b;
  x = a + b;
  i = 0;
  while (x > 0) {
    i++;
    x -= i;
    if (x >= 0) c[i] = i;
  }
  k = i;
  a1 = a;
  ma = 0;
  mb = 0;
  j = k;
  while ((a1 > 0) && (j > 0)) {
    if (c[j] != 0) {
      if (a1 - c[j] >= 0) {
        a1 -= c[j];
        ma++;
        ra[ma] = c[j];
        c[j] = 0;
      } else
        j--;
    } else {
      j--;
    }
  }
  for (int i = 1; i <= k; i++) {
    if (c[i] != 0) {
      if (b - c[i] >= 0) {
        b -= c[i];
        mb++;
        rb[mb] = c[i];
        c[i] = 0;
      } else
        break;
    }
  }
  cout << ma << "\n";
  for (int i = 1; i <= ma; i++) {
    cout << ra[i] << " ";
  }
  cout << "\n" << mb;
  cout << "\n";
  for (int i = 1; i <= mb; i++) {
    cout << rb[i] << " ";
  }
}
