#include <bits/stdc++.h>
using namespace std;
void solve() {
  int a, b;
  cin >> a >> b;
  set<int> fir, sec;
  int curr = 0, ele = 0;
  for (int i = 1;; i++) {
    if (curr + i <= a) {
      ele++;
      fir.insert(i);
      curr += i;
    } else {
      int extra = curr + i - a;
      if (fir.count(extra) && extra <= b) {
        fir.erase(extra);
        fir.insert(i);
        sec.insert(extra);
        ele++;
        curr = extra;
        break;
      } else {
        curr = 0;
        break;
      }
    }
  }
  for (int i = ele + 1;; i++) {
    if (curr + i <= b) {
      curr += i;
      sec.insert(i);
    } else
      break;
  }
  cout << fir.size() << "\n";
  for (auto e : fir) cout << e << " ";
  cout << "\n";
  cout << sec.size() << "\n";
  for (auto e : sec) cout << e << " ";
  cout << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  for (int tt = 1; tt <= t; tt++) {
    solve();
  }
}
