#include <bits/stdc++.h>
using namespace std;
vector<int> v1, v2;
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  bool flag = a > b;
  if (a > b) swap(a, b);
  int n, sum = 0;
  for (n = 0; sum + n + 1 <= a + b; n++, sum += n)
    ;
  int s = 0;
  int i;
  for (i = 0; s <= a; i++, s += i)
    ;
  int t = s - a;
  for (int j = 1; j <= i; j++) {
    if (j != t) v1.push_back(j);
  }
  v2.push_back(t);
  for (int j = i + 1; j <= n; j++) v2.push_back(j);
  if (flag) swap(v1, v2);
  printf("%d\n", v1.size());
  for (int i : v1) printf("%d ", i);
  printf("\n");
  int ss = 0;
  for (int i : v1) ss += i;
  for (int i : v2) ss += i;
  if (ss > a + b) v2.pop_back();
  printf("%d\n", v2.size());
  for (int i : v2) printf("%d ", i);
  printf("\n");
}
