#include <bits/stdc++.h>
using namespace std;
bool vis[300005];
long long a, b;
void make(long long x, long long mv) {
  vector<int> ans;
  while (mv > 0 && x > 0) {
    if (mv > x) mv = x;
    if (vis[mv]) {
      mv--;
      continue;
    } else {
      x -= mv;
      vis[mv] = true;
      ans.push_back(mv);
    }
  }
  int n = ans.size();
  cout << n << endl;
  for (int(i) = 0; (i) < (n); (i)++) cout << ans[i] << ' ';
  cout << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> a >> b;
  long long mv = 0;
  while ((mv * (mv + 1)) / 2 <= a + b) mv++;
  mv--;
  make(a, mv);
  make(b, mv);
  return 0;
}
