#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  int A, B;
  scanf("%d%d", &A, &B);
  int S = A + B;
  long long K = 0;
  while ((K + 1) * (K + 2) / 2 <= S) ++K;
  vector<int> a, b;
  for (int i = (K + 1) - 1; i >= (1); --i) {
    if (i <= A) {
      a.push_back(i);
      A -= i;
    } else {
      b.push_back(i);
      B -= i;
    }
  }
  printf("%d\n", a.size());
  for (auto k : a) printf("%d ", k);
  printf("\n");
  printf("%d\n", b.size());
  for (auto k : b) printf("%d ", k);
  printf("\n");
}
