#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long N = 1e5 + 10;
bool ok;
long long n;
long long fun(long long a) {
  for (long long i = 1;; i++) {
    if ((i * (i + 1) / 2 > a)) {
      return i - 1;
    }
  }
}
signed main() {
  long long a, b;
  cin >> a >> b;
  vector<long long> A;
  vector<long long> B;
  long long x = fun(a + b);
  for (long long i = x; i >= 1; i--) {
    if (a > b) {
      if (i <= b) {
        B.push_back(i);
        b -= i;
      } else {
        A.push_back(i);
        a -= i;
      }
    } else {
      if (i <= a) {
        A.push_back(i);
        a -= i;
      } else {
        B.push_back(i);
        b -= i;
      }
    }
  }
  sort((A).begin(), (A).end());
  sort((B).begin(), (B).end());
  cout << ((long long)(A).size()) << "\n";
  for (auto t : A) {
    cout << t << ' ';
  }
  cout << "\n";
  cout << ((long long)(B).size()) << "\n";
  for (auto t : B) {
    cout << t << ' ';
  }
  cout << "\n";
  return 0;
}
