#include <bits/stdc++.h>
using namespace std;
template <class TH>
void _dbg(const char *sdbg, TH h) {
  cerr << sdbg << " = " << h << endl;
}
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << " = " << h << ", ";
  _dbg(sdbg + 1, a...);
}
const int maxn = (1e6) + 7;
const int maxk = 20;
const int inf = (1e9) + 7;
const long long LLinf = ((long long)1e18) + 7LL;
const long double eps = 1e-9;
const long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long a, b;
  cin >> a >> b;
  long long suma = a + b;
  long long numer = 1;
  while (suma >= numer) {
    suma -= numer;
    numer++;
  }
  numer--;
  vector<int> V;
  for (int i = 1; i <= numer; i++) V.push_back(i);
  reverse(V.begin(), V.end());
  vector<int> res, res2;
  for (auto s : V) {
    if (a < s) {
      res2.push_back(s);
      b -= s;
    } else {
      res.push_back(s);
      a -= s;
    }
  }
  sort(res.begin(), res.end());
  sort(res2.begin(), res2.end());
  cout << ((int)(res).size()) << "\n";
  for (auto s : res) cout << s << " ";
  cout << "\n";
  cout << ((int)(res2).size()) << "\n";
  for (auto s : res2) cout << s << " ";
  return 0;
}
