#include <bits/stdc++.h>
template <typename T>
inline void read(T &x) {
  x = 0;
  register char ch;
  register bool fl = 0;
  while (ch = getchar(), ch < 48 || 57 < ch) fl ^= ch == '-';
  x = (ch & 15);
  while (ch = getchar(), 47 < ch && ch < 58)
    x = (x << 1) + (x << 3) + (ch & 15);
  if (fl) x = -x;
}
template <typename T>
inline void readc(T &x) {
  while (x = getchar(), !islower(x) && !isupper(x))
    ;
}
template <typename T>
inline void print(T x, char c = ' ') {
  static long long buf[40];
  if (x == 0) {
    putchar('0');
    putchar(c);
    return;
  }
  if (x < 0) putchar('-'), x = -x;
  for (buf[0] = 0; x; x /= 10) buf[++buf[0]] = x % 10 + 48;
  while (buf[0]) putchar((char)buf[buf[0]--]);
  putchar(c);
}
const long long maxn = 2000010;
long long a, b, ans, lena, lenb, p[maxn], s[maxn];
bool used[maxn];
signed main() {
  read(a), read(b);
  for (long long x = 1; x <= 1e5; x++)
    if (a >= x)
      a -= x, used[x] = true, ans++;
    else {
      used[x] = 1;
      used[x - a] = 0;
      break;
    }
  for (long long x = 1; x <= 1e5; x++)
    if (used[x]) p[++lena] = x;
  for (long long x = 1; x <= 1e5; x++)
    if (!used[x] && b >= x) ans++, b -= x, s[++lenb] = x;
  print(lena, '\n');
  for (long long i = 1; i <= lena; i++) print(p[i]);
  putchar('\n'), print(lenb, '\n');
  for (long long i = 1; i <= lenb; i++) print(s[i]);
  putchar('\n');
  return 0;
}
