#include <bits/stdc++.h>
using namespace std;
vector<int> A, B;
int main() {
  int a, b, SUM = 0, tar;
  scanf("%d%d", &a, &b);
  for (tar = 1;; ++tar) {
    SUM += tar;
    if (SUM >= a + b) {
      if (SUM > a + b) {
        --tar;
        break;
      } else
        break;
    }
  }
  for (int i = tar; i >= 1; --i) {
    if (a >= i) {
      A.push_back(i);
      a -= i;
    } else
      B.push_back(i);
  }
  printf("%d\n", A.size());
  for (int i = 0; i < A.size(); ++i) printf("%d ", A[i]);
  printf("\n");
  printf("%d\n", B.size());
  for (int i = 0; i < B.size(); ++i) printf("%d ", B[i]);
  return 0;
}
