#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  int maxa = 0;
  int suma = 0;
  int sumb = 0;
  bool flag = false;
  int sa, sb;
  int n = 0, m = 0;
  cin >> a >> b;
  for (int i = 1; a - suma >= i; i++) {
    suma += i;
    maxa = i;
    n++;
  }
  cout << n << endl;
  for (int i = 1; i <= n; i++) {
    if (i != maxa - (a - suma) + 1) cout << i << ' ';
  }
  if (a != suma)
    cout << maxa + 1 << endl;
  else
    cout << endl;
  if (b >= maxa - (a - suma) + 1) {
    m++;
    b -= maxa - (a - suma) + 1;
    flag = true;
  }
  sumb = 0;
  for (int i = maxa + 2; b - sumb >= i; i++) {
    sumb += i;
    m++;
  }
  sumb = 0;
  cout << m << endl;
  if (b >= 0 && flag) {
    cout << maxa - (a - suma) + 1 << ' ';
  }
  for (int i = maxa + 2; i < maxa + 2 + m - 1; i++) {
    cout << i << ' ';
  }
  cin >> n;
  return 0;
}
