#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int n = 1;
  while ((long long)n * (n + 1) / 2 <= (a + b)) {
    n++;
  }
  n--;
  int *p = new int[n + 1];
  memset(p, 0, sizeof(int) * (n + 1));
  int minus = a;
  int ans1 = 0;
  if (b != 0)
    while (a >= 0 && a != 0) {
      if (minus <= n && a - minus >= 0) {
        a = a - minus;
        p[minus]++;
        ans1++;
        if (a == 0) break;
      }
      minus--;
    }
  else {
    memset(p, 1, sizeof(int) * (n + 1));
    ans1 = n;
  }
  cout << ans1 << endl;
  for (int j = 1; j <= n; j++) {
    if (p[j] != 0) cout << j << " ";
  }
  cout << endl;
  cout << n - ans1 << endl;
  for (int j = 1; j <= n; j++) {
    if (p[j] == 0) cout << j << " ";
  }
}
