#include <bits/stdc++.h>
using namespace std;
vector<int> ans[2];
int swapped = 0;
int a, b;
int main() {
  cin >> a >> b;
  if (a < b) {
    swap(a, b);
    swapped = 1;
  }
  for (int i = 1;; i++) {
    if (a < i) break;
    a -= i;
    ans[0].push_back(i);
  }
  int ind = ans[0].size() - 1;
  while (a--) {
    ans[0][ind--]++;
  }
  map<int, int> mp;
  for (int to : ans[0]) {
    mp[to] = 1;
  }
  for (int i = 1;; i++) {
    if (mp.count(i)) continue;
    if (b < i) break;
    b -= i;
    ans[1].push_back(i);
  }
  if (swapped) swap(ans[0], ans[1]);
  cout << ans[0].size() << endl;
  for (int to : ans[0]) {
    printf("%d ", to);
  }
  cout << endl << ans[1].size() << endl;
  for (int to : ans[1]) {
    printf("%d ", to);
  }
}
