#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long a, b;
  cin >> a >> b;
  long long sum = a + b;
  long long cou = 0;
  while (sum > cou) {
    ++cou;
    sum -= cou;
  }
  vector<long long> res_a;
  vector<long long> res_b;
  while (cou > 0) {
    if (a - cou >= 0) {
      a -= cou;
      res_a.push_back(cou);
    } else {
      res_b.push_back(cou);
    }
    --cou;
  }
  cout << res_a.size() << '\n';
  for (auto it : res_a) cout << it << ' ';
  cout << '\n';
  cout << res_b.size() << '\n';
  for (auto it : res_b) cout << it << ' ';
  cout << '\n';
}
