#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 1e3;
const int M = 5e5 + 5;
const int sz = 1399;
const long double eps = 0.00000001;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int x, y;
  cin >> x >> y;
  set<int> a, b;
  long long s = 0;
  int nw = 1;
  while (x - nw >= 0) {
    x -= nw;
    a.insert(nw);
    nw++;
  }
  int ost = nw - x;
  if (x) {
    a.erase(ost);
    a.insert(nw);
    if (y >= ost) {
      b.insert(ost);
      y -= ost;
    }
    nw++;
  }
  while (y - nw >= 0) {
    y -= nw;
    b.insert(nw);
    nw++;
  }
  cout << a.size() << '\n';
  for (auto &to : a) {
    cout << to << ' ';
  }
  cout << '\n';
  cout << b.size() << '\n';
  for (auto &to : b) {
    cout << to << ' ';
  }
  cout << '\n';
  return 0;
}
