#include <bits/stdc++.h>
using namespace std;
int n, m, maxx, sum, nn;
int main() {
  cin >> n >> m;
  if (n == 0 && m == 0) {
    cout << "0\n\n0";
    return 0;
  }
  if (n == 0) {
    vector<int> vec;
    for (int i = 1; i <= m; i++) {
      if (i > m) break;
      vec.push_back(i);
      m -= i;
    }
    cout << "0\n\n" << vec.size() << endl;
    for (int i = 0; i < vec.size(); i++) {
      cout << vec[i] << " ";
    }
    return 0;
  }
  while (sum <= n + m) {
    maxx++;
    sum += maxx;
    nn++;
  }
  maxx--;
  nn--;
  if (n < 3) {
    cout << "1\n" << n << "\n" << nn - 1 << endl;
    for (int i = 1; i <= maxx; i++)
      if (i != n) cout << i << " ";
  } else {
    if (maxx >= n) {
      cout << "1\n" << n << endl << nn - 1 << endl;
      for (int i = 1; i <= maxx; i++)
        if (i != n) cout << i << " ";
    } else {
      vector<int> vec1, vec2;
      int ost1 = n, ost2 = m;
      for (int i = maxx; i >= 1; i--) {
        if (i <= ost1) {
          ost1 -= i;
          vec1.push_back(i);
        } else {
          vec2.push_back(i);
        }
      }
      cout << vec1.size() << endl;
      for (int i = 0; i < vec1.size(); i++) cout << vec1[i] << " ";
      cout << endl << vec2.size() << endl;
      for (int i = 0; i < vec2.size(); i++) cout << vec2[i] << " ";
    }
  }
  return 0;
}
