#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
set<int> s;
void run_case() {
  s.clear();
  int n, m;
  cin >> n >> m;
  int sum = n + m;
  int bp = -1;
  for (int i = 1;; i++) {
    if (1ll * i * (i + 1) > 2ll * sum) {
      bp = i - 1;
      break;
    }
  }
  for (int i = 1; i <= bp; i++) {
    s.insert(i);
  }
  vector<int> a, b;
  bool swapped = false;
  if (n > m) {
    swap(n, m);
    swapped = true;
  }
  __f("bp, swapped, sum", bp, swapped, sum);
  while (n > 0 && s.size()) {
    auto l = s.lower_bound(n);
    if (l == s.begin()) {
      if (*l == n) {
        a.push_back(*l);
        s.erase(l);
      }
      break;
    }
    if (l == s.end()) {
      l--;
    }
    a.push_back(*l);
    n -= *l;
    s.erase(l);
  }
  while (m > 0 && s.size()) {
    auto l = s.lower_bound(m);
    if (l == s.begin()) {
      if (*l == m) {
        b.push_back(*l);
        s.erase(l);
      }
      break;
    }
    if (l == s.end()) {
      l--;
    }
    b.push_back(*l);
    m -= *l;
    s.erase(l);
  }
  if (swapped) {
    cout << b.size() << "\n";
    for (int i : b) {
      cout << i << " ";
    }
    cout << "\n";
    cout << a.size() << "\n";
    for (int i : a) {
      cout << i << " ";
    }
    cout << "\n";
  } else {
    cout << a.size() << "\n";
    for (int i : a) {
      cout << i << " ";
    }
    cout << "\n";
    cout << b.size() << "\n";
    for (int i : b) {
      cout << i << " ";
    }
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int tt = 1;
  while (tt--) {
    run_case();
  }
  return 0;
}
