#include <bits/stdc++.h>
using namespace std;
vector<int> ans1, ans2;
bool taken[100005];
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  bool f = 0;
  if (a > b) {
    f = 1;
    swap(a, b);
  }
  long long sum = 0;
  int lm = 0;
  for (int i = 1; sum <= a + b; i++) {
    sum += i;
    lm = i;
  }
  lm--;
  for (int i = lm; i >= 1; i--) {
    if (a >= i) {
      a -= i;
      ans1.push_back(i);
    } else
      ans2.push_back(i);
  }
  if (f) swap(ans1, ans2);
  printf("%d\n", ans1.size());
  for (int i = 0; i < ans1.size(); i++) printf("%d ", ans1[i]);
  cout << endl;
  printf("%d\n", ans2.size());
  for (int i = 0; i < ans2.size(); i++) printf("%d ", ans2[i]);
}
