#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1e6;
long long a, b;
long long ans;
int s[MAX], s1[MAX];
int len, len1;
bool bb[MAX];
int main() {
  scanf("%lld%lld", &a, &b);
  for (long long i = 1; i <= MAX; i++)
    if (i * (i + 1) / 2 > (a + b)) {
      ans = i - 1;
      break;
    }
  for (int i = ans; i >= 1; i--)
    if (a >= i) {
      s[++len] = i;
      a -= i;
      bb[i] = 1;
    }
  for (int i = 1; i <= ans; i++)
    if (!bb[i]) {
      s1[++len1] = i;
    }
  printf("%d\n", len);
  for (int i = 1; i <= len; i++) printf("%d ", s[i]);
  printf("\n");
  printf("%d\n", len1);
  for (int i = 1; i <= len1; i++) printf("%d ", s1[i]);
}
