#include <bits/stdc++.h>
using namespace std;
void Solve() {
  long long int a, b;
  cin >> a >> b;
  long long int n = 0;
  while (n * n + n <= 2 * a + 2 * b) ++n;
  --n;
  vector<int> ans1, ans2;
  while (n != 0) {
    if (a >= n) {
      ans1.push_back(n);
      a -= n;
    } else {
      ans2.push_back(n);
      b -= n;
    }
    --n;
  }
  cout << ans1.size() << endl;
  for (int i = 0; i < ans1.size(); ++i) cout << ans1[i] << " ";
  cout << endl;
  cout << ans2.size() << endl;
  for (int i = 0; i < ans2.size(); ++i) cout << ans2[i] << " ";
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  Solve();
  return 0;
}
