#include <bits/stdc++.h>
using namespace std;
long long a, b;
bool ans[100000];
bool ans1[100000];
void res() {
  long long k = 0;
  while ((k + 2) * (k + 1) / 2 <= a + b) k++;
  long long sum = 0;
  long long cnt = 0;
  for (long long i = 0; i < k; i++) {
    if ((sum + i + 1 + i + 2) <= min(a, b)) {
      sum += (i + 1);
      ans[i] = true;
      cnt++;
    } else {
      if ((min(a, b) - sum - 1) >= i) {
        ans[min(a, b) - sum - 1] = true;
        cnt++;
      }
      break;
    }
  }
  if (a <= b) {
    cout << cnt << endl;
    for (long long i = 0; i < k; i++) {
      if (ans[i]) cout << i + 1 << ' ';
    }
    cout << endl;
    cout << k - cnt << endl;
    for (long long i = 0; i < k; i++) {
      if (!ans[i]) cout << i + 1 << ' ';
    }
    cout << endl;
  } else {
    cout << k - cnt << endl;
    for (long long i = 0; i < k; i++) {
      if (!ans[i]) cout << i + 1 << ' ';
    }
    cout << endl;
    cout << cnt << endl;
    for (long long i = 0; i < k; i++) {
      if (ans[i]) cout << i + 1 << ' ';
    }
    cout << endl;
  }
  return;
}
signed main() {
  ios_base ::sync_with_stdio(0);
  cin >> a >> b;
  long long k = 0;
  while ((k + 2) * (k + 1) / 2 <= a + b) {
    k++;
  }
  long long sum = a;
  long long cnt = 0;
  for (long long i = k; i >= 1; i--) {
    if (sum >= i) {
      sum -= i;
      ans[i - 1] = true;
      cnt++;
    }
  }
  sum = b;
  long long cnt1 = 0;
  for (long long i = k; i >= 1; i--) {
    if (sum >= i && !ans[i - 1]) {
      sum -= i;
      cnt1++;
      ans1[i - 1] = true;
    }
  }
  cout << cnt << endl;
  for (long long i = 0; i < k; i++) {
    if (ans[i]) cout << i + 1 << ' ';
  }
  cout << endl;
  cout << cnt1 << endl;
  for (long long i = 0; i < k; i++) {
    if (ans1[i]) cout << i + 1 << ' ';
  }
  cout << endl;
  return 0;
}
