#include <bits/stdc++.h>
using namespace std;
const long long Up = 155555;
long long A, B;
long long ans1[Up], ans2[Up];
int top1, top2;
long long up;
bool flag = 0;
int main() {
  scanf("%I64d%I64d", &A, &B);
  if (A > B) swap(A, B), flag = 1;
  long long sum = A + B;
  for (long long i = 1; i <= Up; i++) {
    if (((i * (i - 1)) >> 1) > sum) {
      up = i - 1;
      break;
    }
  }
  for (int i = up - 1; i >= 1; i--) {
    if (B >= i) {
      ans2[++top2] = i;
      B -= i;
    } else if (A >= i) {
      ans1[++top1] = i;
      A -= i;
    }
  }
  if (A >= up) ans1[++top1] = A;
  if (B >= up && B != A) ans2[++top2] = B;
  if (flag) {
    swap(top1, top2);
    swap(ans1, ans2);
  }
  printf("%d\n", top1);
  for (int i = 1; i <= top1; i++) {
    printf("%I64d ", ans1[i]);
  }
  printf("\n%d\n", top2);
  for (int i = 1; i <= top2; i++) {
    printf("%I64d ", ans2[i]);
  }
  return 0;
}
