#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  return x * f;
}
int n, a, b, ans, ansa[1000000], ansb[1000000], cnta, cntb;
bool flag[1000000];
bool check(int k) {
  int w = a;
  cnta = cntb = 0;
  for (int i = 1; i <= k; i++)
    if (w >= i)
      ansa[++cnta] = i, w -= i;
    else
      break;
  ansa[cnta + 1] = k + 1;
  for (int i = cnta; i >= 1; i--) {
    if (!w) break;
    while (w && ansa[i] + 1 < ansa[i + 1]) ansa[i]++, w--;
  }
  if (b >= 1ll * k * (k + 1) / 2 - (a - w))
    return 1;
  else
    return 0;
}
int main() {
  a = read(), b = read();
  n = sqrt((a + b) * 2ll) + 2;
  int l = 0, r = n;
  while (l <= r) {
    int mid = l + r >> 1;
    if (check(mid))
      ans = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  int w = a;
  cnta = cntb = 0;
  for (int i = 1; i <= ans; i++)
    if (w >= i)
      ansa[++cnta] = i, w -= i;
    else
      break;
  ansa[cnta + 1] = ans + 1;
  for (int i = cnta; i >= 1; i--) {
    if (!w) break;
    while (w && ansa[i] + 1 < ansa[i + 1]) ansa[i]++, w--;
  }
  printf("%d\n", cnta);
  for (int i = 1; i <= cnta; i++) printf("%d ", ansa[i]), flag[ansa[i]] = 1;
  cout << endl;
  printf("%d\n", ans - cnta);
  for (int i = 1; i <= ans; i++)
    if (!flag[i]) printf("%d ", i);
  return 0;
}
