#include <bits/stdc++.h>
using namespace std;
long long a, b;
long long vis[1000005];
long long aa[1000005];
long long bb[1000005];
int main() {
  long long ans = 0;
  scanf("%lld%lld", &a, &b);
  long long x = 1;
  while ((a + b) >= ans) {
    ans += x;
    x++;
  }
  x -= 2;
  long long cnt1 = 0;
  long long cnt2 = 0;
  while (x) {
    if (a >= x)
      aa[cnt1++] = x, a -= x;
    else
      bb[cnt2++] = x, b -= x;
    x--;
  }
  printf("%lld\n", cnt1);
  for (int i = 0; i < cnt1; i++) printf("%lld ", aa[i]);
  printf("\n");
  printf("%lld\n", cnt2);
  for (int i = 0; i < cnt2; i++) printf("%lld ", bb[i]);
  printf("\n");
  return 0;
}
