#include <bits/stdc++.h>
using namespace std;
int vis[223123], a, b, tot, s, as, bs, l, o, r, x, y;
bool check(bool flag) {
  memset(vis, 0, sizeof(vis));
  x = a;
  y = min(o, a);
  tot = 0;
  while (x && y) {
    x -= y;
    vis[y] = 1;
    ++tot;
    y = min(x, y - 1);
  }
  s = 0;
  for (int i = 1; i <= o; ++i)
    if (!vis[i] && s + i <= b) {
      ++tot;
      s += i;
    }
  if (tot == o && flag) {
    as = bs = 0;
    for (int i = 1; i <= o; ++i)
      if (vis[i]) ++as;
    cout << as << endl;
    for (int i = 1; i <= o; ++i)
      if (vis[i]) printf("%d ", i);
    printf("\n");
    for (int i = 1; i <= o; ++i)
      if (!vis[i]) ++bs;
    cout << bs << endl;
    for (int i = 1; i <= o; ++i)
      if (!vis[i]) printf("%d ", i);
    printf("\n");
  }
  if (tot == o)
    return 1;
  else
    return 0;
}
int main() {
  scanf("%d%d", &a, &b);
  l = 0;
  r = 1e5;
  while (l < r) {
    o = l + r + 1 >> 1;
    if (check(0))
      l = o;
    else
      r = o - 1;
  }
  o = l;
  check(1);
  return 0;
}
