#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int a, b;
  cin >> a >> b;
  int k = 0;
  ll sum = 0;
  while (sum <= a + b) {
    sum += ++k;
  }
  --k;
  vector<bool> used(k);
  int j = k;
  while (a > 0 && j > 0) {
    if (a - j >= 0) {
      used[j - 1] = true;
      a -= j;
    }
    --j;
  }
  vector<int> first, second;
  for (int i = 0; i < k; ++i) {
    if (used[i]) {
      first.emplace_back(i + 1);
    } else {
      second.emplace_back(i + 1);
    }
  }
  cout << first.size() << '\n';
  for (int v : first) {
    cout << v << ' ';
  }
  cout << '\n' << second.size() << '\n';
  for (int v : second) {
    cout << v << ' ';
  }
  cout << '\n';
  return 0;
}
