#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
using ii = pair<int, int>;
using ll = long long;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  vector<int> ans1, ans2;
  ll limit = 0;
  for (; limit * (limit + 1) / 2 <= a + b; limit++)
    ;
  cerr << limit << '\n';
  for (int i = --limit; i >= 1; i--) {
    if (a >= b)
      ans1.push_back(i), a -= i;
    else
      ans2.push_back(i), b -= i;
  }
  cout << ans1.size() << '\n';
  for (auto x : ans1) cout << x << ' ';
  cout << '\n';
  cout << ans2.size() << '\n';
  for (auto x : ans2) cout << x << ' ';
  cout << '\n';
  return 0;
}
