#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long read() {
  long long s = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * f;
}
long long sum = 0;
long long tot1 = 0, tot2 = 0, nw = 0, a[1010010], b[1010100];
signed main() {
  n = read(), m = read();
  if (n == 0 && m == 1) {
    cout << 0 << endl << endl << 1 << endl << 1;
    return 0;
  }
  if (n == 1 && m == 0) {
    cout << 1 << endl << 1 << endl << 0 << endl << endl;
    return 0;
  }
  sum = n + m;
  long long u = 0;
  for (long long i = 1; i <= sum; ++i) {
    u += i;
    if (u > sum) {
      nw = i - 1;
      break;
    }
  }
  for (long long i = nw; i >= 1; --i) {
    if (n - i >= 0) {
      a[++tot1] = i;
      n -= i;
    } else if (m - i >= 0) {
      b[++tot2] = i;
      m -= i;
    }
  }
  cout << tot1 << endl;
  for (long long i = 1; i <= tot1; ++i) {
    cout << a[i] << " ";
  }
  cout << endl;
  cout << tot2 << endl;
  for (long long i = 1; i <= tot2; ++i) {
    cout << b[i] << " ";
  }
  cout << endl;
}
