#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  scanf("%lld %lld", &n, &m);
  long long ans = 0;
  while ((ans + 1) * (ans + 2) / 2 <= (n + m)) ans++;
  vector<int> f, s;
  for (int i = ans; i >= 1; i--) {
    if (n >= i) {
      f.push_back(i);
      n -= i;
    } else
      s.push_back(i);
  }
  printf("%d\n", (int)f.size());
  for (auto x : f) printf("%d ", x);
  printf("\n");
  printf("%d\n", (int)s.size());
  for (auto x : s) printf("%d ", x);
  printf("\n");
  return 0;
}
