#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int a, b;
  cin >> a >> b;
  int n = a + b;
  set<int> s;
  for (int i = 1; n - i >= 0; i++) {
    s.insert(i);
    n -= i;
  }
  vector<int> va, vb;
  int was = s.size();
  while (!s.empty()) {
    was = s.size();
    if (a > b) {
      int x = *s.rbegin();
      if (x <= a) {
        va.push_back(x);
        s.erase(x);
        a -= x;
        if (s.empty())
          break;
        else
          x = *s.rbegin();
      }
      if (x <= b) {
        vb.push_back(x);
        s.erase(x);
        b -= x;
      }
    } else {
      int x = *s.rbegin();
      if (x <= b) {
        vb.push_back(x);
        s.erase(x);
        b -= x;
        if (s.empty())
          break;
        else
          x = *s.rbegin();
      }
      if (x <= a) {
        va.push_back(x);
        s.erase(x);
        a -= x;
      }
    }
    if (was == s.size()) break;
  }
  cout << va.size() << endl;
  for (int i : va) cout << i << ' ';
  cout << endl << vb.size() << endl;
  for (int i : vb) cout << i << ' ';
  return 0;
}
