#include <bits/stdc++.h>
using namespace std;
int a, b;
priority_queue<int> v1, v2;
int main() {
  scanf("%d %d", &a, &b);
  int x = sqrt((long long)(a + b) * 2);
  for (int i = x; i >= 1; i--) {
    if (a - i >= 0) {
      a -= i;
      v1.push(i);
    } else if (b - i >= 0) {
      b -= i;
      v2.push(i);
    } else if (i == 1 or (v1.empty() and v2.empty()))
      continue;
    else {
      if (v1.empty()) {
        b += v2.top();
        b -= i;
        v2.push(i);
        v2.pop();
      } else if (v2.empty()) {
        a += v1.top();
        a -= i;
        v1.push(i);
        v1.pop();
      } else if (v1.top() < v2.top()) {
        b += v2.top();
        b -= i;
        v2.push(i);
        v2.pop();
      } else {
        a += v1.top();
        a -= i;
        v1.push(i);
        v1.pop();
      }
    }
  }
  printf("%d\n", v1.size());
  while (!v1.empty()) {
    printf("%d", v1.top());
    v1.pop();
    if (v1.empty())
      printf("\n");
    else
      printf(" ");
  }
  printf("%d\n", v2.size());
  while (!v2.empty()) {
    printf("%d", v2.top());
    v2.pop();
    if (v2.empty())
      printf("\n");
    else
      printf(" ");
  }
}
