#include <bits/stdc++.h>
using namespace std;
int mark[1000000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int a, b, i, j, n, m, s = 0, sum;
  cin >> a >> b;
  long long int x = 0;
  while (((x + 1) * (x + 2)) / 2 <= (a + b)) x++;
  vector<int> p, q;
  for (i = x; i >= 1; i--)
    if (i <= a) {
      a -= i;
      mark[i] = 1;
      s++;
      p.push_back(i);
    } else
      q.push_back(i);
  cout << p.size() << "\n";
  for (i = 0; i < p.size(); i++) cout << p[i] << " ";
  cout << "\n" << q.size() << "\n";
  for (i = 0; i < q.size(); i++) cout << q[i] << " ";
}
