#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000000;
const int N = 300000;
int main() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int a, b;
  cin >> a >> b;
  string outa, outb;
  bool swaped = 0;
  if (a > b) {
    swap(a, b);
    swaped = 1;
  }
  int last = 0;
  int an = 0;
  for (int i = 1; a >= i; i++) {
    a -= i;
    last = i;
    an++;
  }
  int changed_from = 0;
  int changed_on = 0;
  if (a > 0) {
    changed_from = last + 1 - a;
    changed_on = last + 1;
  }
  int bn = 0;
  if (b > changed_from) {
    b -= changed_from;
    if (changed_from) bn++;
  }
  for (int i = last + 1 + int(bool(changed_from)); b >= i; i++) {
    b -= i;
    bn++;
  }
  outa = to_string(an) + "\n";
  for (int i = 1; i <= an; i++) {
    if (i == changed_from)
      outa += to_string(changed_on) + " ";
    else {
      outa += to_string(i) + " ";
    }
  }
  outb = to_string(bn) + "\n";
  if (bn > 0) {
    if (changed_from) {
      outb += to_string(changed_from) + " ";
      for (int i = last + 2; i < last + 1 + bn; i++) outb += to_string(i) + " ";
    } else {
      for (int i = last + 1; i < last + 1 + bn; i++) outb += to_string(i) + " ";
    }
  }
  if (swaped)
    cout << outb << "\n" << outa;
  else {
    cout << outa << "\n" << outb;
  }
  return 0;
}
