#include <bits/stdc++.h>
const int INF = (int)1e9;
const int long minINF = (int)-1e9;
const int mod = (int)1e9 + 7;
const int MAXN = (int)1e9 + 5;
using namespace std;
vector<long long> lst[2];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long a, b;
  cin >> a >> b;
  long long n = sqrt(2 * (a + b));
  while (n * (n + 1) > 2 * (a + b)) {
    n--;
  }
  for (long long i = n; i >= 1; i--) {
    if (a >= i) {
      lst[0].push_back(i);
      a -= i;
    } else {
      lst[1].push_back(i);
      b -= i;
    }
  }
  cout << lst[0].size() << '\n';
  for (auto u : lst[0]) cout << u << " ";
  cout << '\n' << lst[1].size() << '\n';
  for (auto u : lst[1]) cout << u << " ";
}
