#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll a, b;
  scanf("%lld%lld", &a, &b);
  ll sum = a + b;
  vector<ll> ans;
  ll total = 0;
  ll i;
  for (i = 1; total <= sum; ++i) {
    total += i;
    if (total > sum) break;
    ans.push_back(i);
  }
  total -= i;
  vector<ll> p, q;
  sum = 0;
  for (int i = ans.size() - 1; i >= 0; --i) {
    if (sum + ans[i] <= b) {
      sum += ans[i];
      q.push_back(ans[i]);
      ans[i] = -1;
      if (sum == b) break;
    }
  }
  for (ll xx : ans) {
    if (xx == -1) continue;
    p.push_back(xx);
  }
  cout << p.size() << "\n";
  for (ll x : p) {
    cout << x << " ";
  }
  cout << "\n";
  cout << q.size() << "\n";
  for (ll x : q) {
    cout << x << " ";
  }
  cout << "\n";
  return 0;
}
